IOS indexPathsForVisibleItems原理

来源:互联网 发布:西门子s7一200编程视频 编辑:程序博客网 时间:2024/05/29 19:57
通过对UICollectionView的滑动 打印

NSArray *cellIndices = [self.collectionViewindexPathsForVisibleItems];

NSLog(@"%@",cellIndices);

结果:1.

(

    "<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}"

)

2.

(

    "<NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}",

    "<NSIndexPath: 0xc000000000000056> {length = 2, path = 1 - 0}"

)

3.

(

    "<NSIndexPath: 0xc000000000000096> {length = 2, path = 2 - 0}",

    "<NSIndexPath: 0xc000000000000056> {length = 2, path = 1 - 0}"

)

4.

(

    "<NSIndexPath: 0xc000000000000096> {length = 2, path = 2 - 0}",

    "<NSIndexPath: 0xc0000000000000d6> {length = 2, path = 3 - 0}"

)

5.

(

    "<NSIndexPath: 0xc0000000000000d6> {length = 2, path = 4 - 0}"

    "<NSIndexPath: 0xc0000000000000d6> {length = 2, path = 3 - 0}"

)

6.

(

    "<NSIndexPath: 0xc0000000000000d6> {length = 2, path = 4 - 0}"

    "<NSIndexPath: 0xc0000000000000d6> {length = 2, path = 5 - 0}"

)

......


结论:系统对可见cell的复用原理是替换原先的旧值,这里我们就必须特殊的使用这个复用数组。


0 0
原创粉丝点击