Both #80 and #143 show that self-sizing cells with IGListKit is a little hard to follow. I think we need to get a working example. Some things that would be great to see:
hi guys we are working on a new project that really needs self sizing cells, any working example somwhere yet? i have used the estimatedItemSize and preferredLayoutAttributesFitting and its working but on the first load the cells are animating to the size which looks not so good.
I have the same problem, on first launch the cells are animating from zero size to current size. I was using layout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize and preferredLayoutAttributesFittingAttributes and laying out cells with auto layout. Later I threw away both and created dummy cells instead to get the height of the cells when they are laid out and return that in sizeForItem(at index:) but still initial animation persists.
@rotemdoron @akaralar check out #176, got it working with both nibs and just code. Hopefully this helps!
hi rnystrom thank you! the problam is we are waiting for data from a web service as you probably do. so we do the performUpdates which with self sizing cells make the collectionview very "jumpy" animating all cells at once and animating from 0 to the size in first load. any idea's how to solve this? (happens also without performUpdates with animate, still jump just without the animation)
@rotemdoron Hmm, that's an interesting example. First simple idea is to do adapter.performUpdates(animated: false) if its the first load?
@rnystrom still happens just without the animation, it jumps to the size instead of animating to it also looks bad. performUpdates updated the entire list though and not only the "diffable" changed object, when using estimatedSize i mean.
@rotemdoron that sort of sounds expected though since you start w/out any data and then load w/ data. I might not totally understand what is happening with self-sizing cells though when it animates in.
Is there a chance you could provide an example setup that has the behavior you're seeing?
basicly the data array is empty untill data is fetched and when we performUpdates (with self sizing) the entire list jumps in to the size of the cell, it is expected from a collectionview but usually the "jump" is not so ruff, becouse you can use reloadData and not batch update which animate everything.
func objects(for listAdapter: IGListAdapter) -> [IGListDiffable] {
return dataArray
}
@rotemdoron but if you use adapter.performUpdates(animated: false) (or just adapter.reloadData() the update is the same as vanilla collection view, right?
@rnystrom adapter.reloadData() makes the layout messy, i dont know why, basically only when im setting sizeForItem and calculating the size my self, its works good, self sizing cells not working so good after performUpdate() (animated or not) and reloadData()
I have the same problem,but i dont known how to solve it
Most helpful comment
basicly the data array is empty untill data is fetched and when we performUpdates (with self sizing) the entire list jumps in to the size of the cell, it is expected from a collectionview but usually the "jump" is not so ruff, becouse you can use reloadData and not batch update which animate everything.
func objects(for listAdapter: IGListAdapter) -> [IGListDiffable] {
return dataArray
}