2016-09-30 3 views
0

ログイン方法で:UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:間違ったindexPath再利用セル

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

第一loaddataの

2016-09-30 15:55:28.764 MYAPP[12950:384498] PosterCell-0: <PosterCell: 0x7fdd3c57cf90> 

2016-09-30 15:55:28.782 MYAPP[12950:384498] PosterCell-1: <PosterCell: 0x7fdd3c4cc0c0> 

2016-09-30 15:55:28.807 MYAPP[12950:384498] PosterCell-2: <PosterCell: 0x7fdd3c5815e0> 

第二reloadData

あなたが見
2016-09-30 15:55:28.959 MYAPP[12950:384498] PosterCell-0: <PosterCell: 0x7fdd3c5815e0> 

2016-09-30 15:55:28.961 MYAPP[12950:384498] PosterCell-1: <PosterCell: 0x7fdd3c57cf90> 

2016-09-30 15:55:28.962 MYAPP[12950:384498] PosterCell-2: <PosterCell: 0x7fdd3c4cc0c0> 

、2つの負荷でXRKPosterCell-0異なります。どうして?

+0

私が知っているコレクションビュー –

答えて

1

dequeueResuableCellを使用して作成されたセルを再利用するためです。

すぎて他の細胞にリロード2と1をリロード比較...あなたは

postercell-0 in reload1 = postercell1 in reload2 
PosterCell-1 in reload1 = PosterCell-2 in reload2 
PosterCell-2 in reload1 = PosterCell-0 in reload2. 

細胞はちょうど再利用されていることを観察することができます!

+0

のために使用したすべてのデリゲートメソッドを表示できますか?なぜreert1のpostercell-0 = reload2のPosterCell-0 – weiminghuaa

+0

間違った再利用者が原因でimageViewのちらつき画面が表示される – weiminghuaa

関連する問題