當(dāng)collection view 執(zhí)行insert,delete時(shí),就會(huì)調(diào)用,layout 的
override func prepare(forCollectionViewUpdates updateItems: [UICollectionViewUpdateItem])
為動(dòng)畫等作準(zhǔn)備,今天發(fā)現(xiàn)一個(gè)有趣的肯有點(diǎn)無語的的東西.今天調(diào)試familyTree的時(shí)候,動(dòng)畫顯示有點(diǎn)問題,就把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]])
我在collectionView的performBatchUpdates同時(shí)執(zhí)行deleteItems[5,0]和deleteSectionssection[6],這個(gè)section[6]里有[6,0],[6,1]兩個(gè).
你看上面,不是
Optional([[5, 0]])
Optional([[5, 0], [6, 0],[6,1]])
而是
Optional([[5, 0]])
Optional([[5, 0], [6, 9223372036854775807]])
我想,這個(gè)[6, 9223372036854775807]就是代表section[6]的意思.就是這個(gè)讓我的動(dòng)畫顯示有問題.
這個(gè)9223372036854775807是Int.max