DraggableCollectionView
DraggableCollectionView copied to clipboard
reloadData issue
This is a very weird issue. It works fine in simulator, but not do the same in real iPhone.
I used [collectionView reloadData]; in didMoveItemAtIndexPath, but just the only cell which I moved refreshed. others cell didn't refresh.
please help me, thanks!
iOS simulator doesn't reuse cells. I think the bug is hidden here.
Alright, it's a little bit tricky, but works for me:
The point is calling reloadData
after some amount of time.
[collectionView performSelector:@selector(reloadData) withObject:nil afterDelay:0.3];
I don't know, why it works, maybe @lukescott will figure it out.
The didMoveItemAtIndexPath feature was added by @ndlupine. Looking at it, it may be because didMoveItemAtIndexPath is called inside the completion handler of performBatchUpdates. That code probably should be inside the completion handler of animateWithDuration after invalidateLayout.
If someone wants to debug this and see if moving the code solves the problem, send me a pull request and I'll merge it.
Nope, unfortunately it doesn't help. Exactly same behaviour.
I found a very tricky thing, not sure if there is helpful. If I dragged it and then there got issue. and if I try press any cell a while, and just release it, don't move it. Then all cells are got reload.
"Nope, unfortunately it doesn't help. Exactly same behaviour." ~wiruzx
Well, I have checked that too, and in my project it works as expected. Cells are reloaded properly.
I see this problem if I flick an item to another location in the UICollectionView
PR #42 fixes this (or will when it's merged)