0

I have a UITableViewCell with a dynamically changing UIView embedded inside it. As normal in UIKit, this embedded View will resize itself with a smooth animation when necessary. So when the inner view is triggered that it should grow an extra 12 points, the outer table view needs to be triggered to grow that outer cell 12 points to accommodate for the inner View's growth.

However, I can't find a method to get the UITableViewCell to adjust it's height without it trying to redraw it's contents.

When you call tableView.reloadRows(at: [IndexPath], with: UITableViewAnimation) it will redraw the contents of the cell being reloaded. I ONLY want the bottom border to be animated to the correct position as well as the rest of the cells in the table view to move properly. How does one force the TV to do this?

Here's a gif of the standard behavior:

Overlapped animation

What I have is a UITableView embedded in each UITableViewCell to display two layers of information. As you can see, calling tableView.reloadRows causes the outer cell to redraw itself and it's children. Meanwhile, the child is still animating itself. So you get this ugly merger of animations. I want some way to reload the outer cells bounds ONLY while letting the child animate itself. This would allow a smooth animation.

lanza
  • 1,512
  • 2
  • 13
  • 26
  • is [this](http://stackoverflow.com/questions/18746929/using-auto-layout-in-uitableview-for-dynamic-cell-layouts-variable-row-heights) your case? you might want to follow the same approach of this [answer](http://stackoverflow.com/questions/39868532/can-i-change-height-of-uitableviewcell-real-time/39870884#39870884) – Ahmad F Oct 11 '16 at 21:49
  • I've tried something like that, the problem is that the animations aren't synchronized. The cell chooses to animate itself and it's children and the animation of the child and the cell are blurred to an ugly result. See my edit to the original post. – lanza Oct 11 '16 at 22:13

0 Answers0