i expand/de-expand a tableviewcell when the user clicks on it. i do this by calling
[tableview beginUpdates];
[tableview endUpdates];
described here http://ift.tt/VpKavW this will recalculate the heights of the cells without reloading the whole tableview.
i usually layout subviews of my custom tableviewcells in
- (void)layoutSubviews {
_aTableViewCellSubView.frame = CGRectMake(0.f, 10.f, self.frame.size.width, 20.f);
...
}
my naive approach was to define a BOOL flag in the custom tableViewCell
initiallyLayedOut = NO;
and set the subviews without animation if this flag is set to NO; after inital layouting i would set it to YES, then always animate the subviews to their new positions/sizes. but this does not really work, as layoutSubviews may get called many times (in my example after resizing the cell, it's call 4 times).
i am a quite experienced iOS-developer, but i can't find a nice solution to this problem...
cheers
Aucun commentaire:
Enregistrer un commentaire