Closed diegorozen closed 7 years ago
@diegorozen good question! I just ran into this yesterday on Instagram 😄
What we do when the cell needs updated is call our configure methods again. Something like:
- (UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index {
MyCell *cell = // dequeue
[cell configureWithData:self.data];
return cell;
}
- (void)didSelectItemAtIndex:(NSInteger)index {
[self.collectionContext invalidateLayoutForSectionController:self completion:nil];
[self configureWithData:self.data];
}
Which works for us. I'd rather leave it to clients that need to reload data to do that manually since cells can be built to respond to changes in other ways, and I don't know think there's a good, single approach.
Sounds reasonable to me 👍
Works great, thanks!
New issue checklist
README
and documentationGeneral information
IGListKit
version: commit 6bdcacThe latest API addition invalidateLayoutForSectionController: allows for a smooth animation of the cells, but cellForItemAtIndex: doesn't get call at the end of the animation. What should be the approach if I wanted to have a different cell layout/configuration for expanded vs collapsed state?
Thanks!