lxcid / LXReorderableCollectionViewFlowLayout

Extends `UICollectionViewFlowLayout` to support reordering of cells. Similar to long press and pan on books in iBook.
http://lxcid.com/
MIT License
1.86k stars 328 forks source link

Why not move instead of insert/delete? #22

Open hpique opened 11 years ago

hpique commented 11 years ago

Any reason for not using moveItemAtIndexPath:toIndexPath: instead of insert/delete here?

Move appears to be a little bit more efficient. Also, it would make the block unnecessary.

lukescott commented 11 years ago

There are already some animation issues that I haven't been able to fix. The reason, I suspect, is that delete and insert is just a shorter animation. With a batch, it's basically the same thing.

hpique commented 11 years ago

If there's a reason, please consider adding a comment. If not it looks arbitrary, and prone to accidental changes.

lxcid commented 11 years ago

I couldn't remember why but from my test it seems to shows that using insert/delete provides a more consistent effect. If I'm not guessing wrongly its something related to #17. I'll remember to put a comment when I get to that issue. :)

lukescott commented 11 years ago

That's a new issue. With the insert/delete or move, the issue is still the same. On my fork I have an experimental patch that either forces a layout change, or does a pre-batch update with nil. Both cancel the animation. Even with that, it doesn't completely fix it as there are other issues.

The insert/delete animation just causes one card to fade out and another to fade in. The move animation actually moves the card, which isn't desirable because you're actually holding the card.

lxcid commented 11 years ago

Oh yeah @lukescott's explanation does ring some bells. I saw your experiment branch the other day. When I'm at this issue I will definitely pull down and see if I can get any progression on it, although it might take some time though.