0

I want to change UICollection View cell data with new data when user tap a button I mean I want to remove previous data and add new one I use collectionView.reloadData() but it adds new data to previous, not replace it. How can I do that?

1
  • Could you add some code about how you populate UICollectionView
    – Breek
    Feb 5, 2016 at 16:23

2 Answers 2

1

Before call reloadData you have to clean the list that you use to populate the collection.

The list is the one that you use in the method:

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section

0

You might be adding the new data to the existing data source.So the new data is added to the existing one. Better to add the code for this in the question.

1
  • The problem might be the logic behind the reload. Can you share the code snippet ,if possible. Feb 5, 2016 at 16:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.