ios - UICollectionViewCell 显示问题?
怪我咯
怪我咯 2017-04-17 17:56:34
0
1
686

如图,上传一张照片后刚开始显示正常,向上将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;

}

求助。

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
刘奇

This is a problem with your cell reuse. There is no need to use alloc - init after register; there will definitely be objects.
Then you didn’t understand this sentence:

cell.upload = self;

What is the process of passing values?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template