This is killing me!
I have a UITableView with cells that has an image, name and phone number in them.
Look here:

Now, I want to expend the cell's height when touching it so I can add some buttons in there. When I expend the cell, I also change it's bg image (to a higher one).
I do it using [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; and it works nice, animates the cell down smoothly, except that it also changes the cell's content:
Anything I can do so the content will stay as it was after cell resizing?
BTW, i did try using,
[_tableView beginUpdates];
[_tableView endUpdates];
but the cell just "jumped" to it's new height so I gave it up.
You can create two custom cells one before expansion and another one for expanded cell.
when you touch the cell store the selected cell indexpath and while reloading the table, in cellForRowAtIndexPath: check the indexpath and load cell accordingly.
You need to be aware of the layouting of the contentView.
If you use Autolayout, check your constraints (cell.contentView.constraints). If you use UIViewAutoresizing, set correct autoresizingMasks (cell.contentView.autoresizingMask) for all subviews of contentView. You could also try to turn off autoResizing (cell.contentView.autoresizesSubviews = NO), but this will likely result in wrong results.
Also I'm wondering, why there is an arrow in the cell backgroundImage? Probably you should use other images too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With