UICollectionView performBatchUpdates 同时插入、删除和移动 [英] UICollectionView performBatchUpdates inserting, deleting, and moving at the same time

查看:42
本文介绍了UICollectionView performBatchUpdates 同时插入、删除和移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 UICollectionViewperformBatchUpdates 方法来执行过滤操作(sorta),并在块内插入单元格,移动单元格, 并删除单元格.我得到了一些奇怪的结果,所以我想知道这种行为是否真的得到支持(我认为指标都搞砸了).我是否只需要将每个类型"的操作(插入、移动和删除)分成单独的、不同的块?

I'm trying to use the UICollectionView's performBatchUpdates 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?

推荐答案

performBatchUpdates 中的所有操作都是针对当前索引执行的.所以不,您不必将插入/删除/移动分解为不同的块,这正是 performBatchUpdates 的用途.没有一些代码或对你所看到的奇怪之处的描述,很难提供帮助......

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

这篇关于UICollectionView performBatchUpdates 同时插入、删除和移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆