THSpringyCollectionView icon indicating copy to clipboard operation
THSpringyCollectionView copied to clipboard

reloadData doesnt always work

Open saqib-saud opened this issue 11 years ago • 2 comments

reloadData doesnt show new data. My example works fine with flowlayout but not with this library.

saqib-saud avatar Dec 30 '13 12:12 saqib-saud

I agree, this library doesn't work when you change your datasource. The reason for that is that _animator 's behavior and _visibleIndexPaths are not reseted completely in prepareLayout. For performance purpose, the developer chose to add only new visible cells and remove those that where not visible. You have to implement a reset method that empty both _ animator and _visibleIndexPaths and call this method on yout layout each time you need to call a reloadData on your collection view. I hope I'm clear.

aurelienp avatar Feb 07 '14 15:02 aurelienp

I just call this method and it works ! thanks !

-(void)resetLayout
{
    [_animator removeAllBehaviors];
    [_visibleIndexPaths removeAllObjects];
}

remstos avatar Feb 15 '14 23:02 remstos