美文网首页Collection view
collection view layout 的删除准备

collection view layout 的删除准备

作者: 轻云绿原 | 来源:发表于2017-07-17 13:41 被阅读52次

当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

相关文章

网友评论

    本文标题:collection view layout 的删除准备

    本文链接:https://www.haomeiwen.com/subject/bolfkxtx.html