UITableView footer animation. View when executing "beginUpdates" "endUpdates"

When I change the height of the cell with the animation (using beginUpdates (), endUpdates ()) I have a very strange animation for my section footer: it moves to the bottom of the table.

here is the simplest code that I could write

func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { return "footer" } func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return cellHeight } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { return tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell } func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { tableView.beginUpdates() cellHeight += 20; tableView.endUpdates() } 

How could I avoid this animation problem?

+5
source share
1 answer

I have the same problem (the footer moves to the bottom of the table and stays there). This is similar to the iOS8 bug (this does not happen on iOS7).

In my case, the workaround is to return the footer as the header of the next section ...

+2
source

Source: https://habr.com/ru/post/1204243/


All Articles