肯定会有很多人遇到下面这样的问题。。。
其实我们只需要在 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