UICollectionView重用机制的问题

时间:2015-05-25 22:24:37   收藏:0   阅读:1503

肯定会有很多人遇到下面这样的问题。。。

技术分享

其实我们只需要在 UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIde forIndexPath:indexPath];下面加这

for (UIView *view in cell.contentView.subviews) {
if (view) {
[view removeFromSuperview];
}
}

就行了。。。。



据网上资料说可以这样解决:

1、自定义一个uicollectioncell,init方法中添加subview, register 这个cell 并与deque方法的identifier设为一致

2、设置subview.frame = cell.contentview.frame



原文:http://blog.csdn.net/u010710758/article/details/45980021

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!