collection view layout 的删除准备

当collection view 执行insert,delete时,就会调用,layout 的

override func prepare(forCollectionViewUpdates updateItems: [UICollectionViewUpdateItem]) 

为动画等作准备,今天发现一个有趣的肯有点无语的的东西.今天调试familyTree的时候,动画显示有点问题,就把updateItems打印出来看看.

<UICollectionViewUpdateItem: 0x7ff869563bf0> index path before update (<NSIndexPath: 0x7ff869588a60> {length = 2, path = 5 - 0}) index path after update ((null)) action (delete)
<UICollectionViewUpdateItem: 0x7ff8695bcad0> index path before update (<NSIndexPath: 0x7ff869556260> {length = 2, path = 6 - 9223372036854775807}) index path after update ((null)) action (delete)
Optional([[5, 0]])
Optional([[5, 0], [6, 9223372036854775807]])

我在collectionViewperformBatchUpdates同时执行deleteItems[5,0]和deleteSectionssection[6],这个section[6]里有[6,0],[6,1]两个.
你看上面,不是

Optional([[5, 0]])
Optional([[5, 0], [6, 0],[6,1]])

而是

Optional([[5, 0]])
Optional([[5, 0], [6, 9223372036854775807]])

我想,这个[6, 9223372036854775807]就是代表section[6]的意思.就是这个让我的动画显示有问题.

这个9223372036854775807是Int.max

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容