Reputation: 1150
I have a basic UICollectionView and a basic list of items. I've implemented a delete button on the items so that the user can remove some of them. Everything works great apart from the item rearrangement while the item is being deleted.
If you delete the item N-1, it visually deletes the first one in the list, moves the last one to the first position and "reuses all the cells" to set the correct content.
Basically, I would have expected it to move the last one to the N-1 item. NOTE: This expected behavior happens when I've got one line and 2 items which makes me believe I did things right somehow.
Questions are :
Upvotes: 3
Views: 603
Reputation: 1150
I figured out the problem. It happened that I was posting a notification after the deleteItemAtIndexPath which was actually calling a setter which was calling collectionView reloadData. This reloadData wasn't supposed to be called at this stage so I fixed it and it works like a charm.
So, if you have funny animations make sure you're not calling a reloadData in a way or another.
Upvotes: 2