r/iOSProgramming • u/JCD2020 • Nov 28 '15
Question Issue with expanding UITableViewCell
I'm trying to implement expanding and collapsing UITableViewCells in my application, I read up on *- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath )indexPath and [tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic]; and [tableView beginUpdates]; [tableView endUpdates]; and I seem to be able to grasp how this should work. Unfortunately, I have a strange issue with how the expanding cell is animated, it seems that the UIView that comes into view when the cell is resized (in blue) is also displayed below the cells that are lower than the expanded cell in the UITableView, here's a screenshot, the final position. Is there any way to hide the part of the expanded cell before the cells below reach the correct position?
Here's the full project if anyone wants to give this a try: http://s000.tinyupload.com/index.php?file_id=56495324939814650050
View all comments
Show parent comment
1
u/b7ade Nov 28 '15
To make autolayout conceptually easier, you can use this pod https://github.com/SnapKit/Masonry and try doing something like:
after adding the subView to the cell's contentView.
But I would definitely read up here as constraints are very nice to work with.