chinabuffet chinabuffet - 1 year ago 90
iOS Question

UICollectionView performBatchUpdates inserting, deleting, and moving at the same time

I'm trying to use the

method to perform a filtering operation (sorta), and inside the block I'm inserting cells, moving cells, and deleting cells. I'm getting some weird results, so I'm wondering if this behavior is actually supported (I'm figuring the indicies are getting all messed up). Do I just need to break each "type" of action (insert, move, and delete) into separate, distinct blocks?

Answer Source

All operations inside performBatchUpdates are performed against the current indices. So no, you shouldn't have to break up insertions/deletions/movements into different blocks, that's exactly what performBatchUpdates is for. Without some code or a description of the weirdness you're seeing it's hard to help...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download