collection view layout 的刪除準(zhǔn)備

當(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]])

我在collectionViewperformBatchUpdates同時(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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容