UICollectionViewCell 显示问题?

如图,上传一张照片后刚开始显示正常,向上将cell划出屏幕上传好的图片就变到第二个item里了。

图片描述

上滑屏幕
图片描述

部分代码:

注册:

[self.pictureCollection registerNib:[UINib nibWithNibName:@"CAPictureCell" bundle:[NSBundle mainBundle]]forCellWithReuseIdentifier:@"capicture"];

代理方法:

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

CAPictureCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"capicture" forIndexPath:indexPath];
cell.upload = self;
cell.indexPath = indexPath;
return cell;

}

求助。

阅读 5.4k
1 个回答

这个就是你的cell复用出问题了。regist之后不需要使用alloc - init;绝对会有对象的。
然后就是你这一句没看懂:

cell.upload = self;

这个传值的过程是怎样的?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题