ios - UICollectionView reuse cell issue -
i have problem collection view cell. when collection view first loaded, display items that:
- (uicollectionviewcell *)collectionview:(uicollectionview *)cv cellforitematindexpath:(nsindexpath *)indexpath; { calendarcell *cell = [cv dequeuereusablecellwithreuseidentifier:@"calendarcell" forindexpath:indexpath]; [cell binddate:_datesmgr.currentmonthitems[indexpath.row] andnowdate:_datesmgr.nowdate]; // bind events if (_eventsmgr.eventsarray.count > 0){ (int = 0; < _eventsmgr.eventsarray.count ; ++) { [cell bindconference:_eventsmgr.eventsarray[i]]; } } return cell; }
inside methods logic adding subviews custom cell class, depend on circumstances.
its work, but, when collection view reloaded (i did force reload after 1 second) of cells reused , placed on others, therefore, show "old" images , subviews.
i see possible solution in forcing uicollection view stop reusing cells (it is, load new cells every time). there way this?
try implement prepareforreuse
method reset old content in custom uicollectionviewcell
-(void)prepareforreuse { [super prepareforreuse]; self.yourimageview.image = nil; //and etc. }
Comments
Post a Comment