Home > Software engineering >  What is the effect of UITableView beginUpdates/endUpdates with nothing between them?
What is the effect of UITableView beginUpdates/endUpdates with nothing between them?

Time:06-23

I'm working on a mature iOS app, and for some reason the original developers often appended this to various methods:

    [self.tableView beginUpdates];
    [self.tableView endUpdates];

So nothing happens between the two calls, and nothing interesting happens before the calls. I searched and was unable to find a reason for such a pattern.

Is it safe to just remove them? If not, then what might the reason be for them?

CodePudding user response:

From the documentation:

You can also use this method followed by the endUpdates() method to animate the change in the row heights without reloading the cell.

If it's not related to animating row heights then it has no effect.

  • Related