美文网首页
解决UICollectionView的Cell复用引起的布局混乱

解决UICollectionView的Cell复用引起的布局混乱

作者: 奋斗吧_程序猿 | 来源:发表于2018-08-16 11:01 被阅读18次

NSString *cellId = [NSString stringWithFormat:@"cellId%ld,%ld,%ld",(long)collectionView.tag,indexPath.section,indexPath.row];
[collectionView registerClass:[MTCameraStickerCell class] forCellWithReuseIdentifier:cellId];
MTCameraStickerCell *cell = (MTCameraStickerCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];

给每个cell 标志唯一的id

相关文章

网友评论

      本文标题:解决UICollectionView的Cell复用引起的布局混乱

      本文链接:https://www.haomeiwen.com/subject/kjunbftx.html