chinabuffet chinabuffet - 4 months ago 20
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?


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...