4

I am dequeueing a reusable custom ItemCollectionViewCell as usual with the method from its parent ViewController

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    ItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
}

but on my ItemCollectionViewCell I have the implemented the method initWithFrame which only gets called initially but not when a cell is dequeued for re-use.

What would be the method which gets triggered inside ItemCollectionView before being re-added to the queue after calling [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath] on the parent view controller?

zanona
  • 12,345
  • 25
  • 86
  • 141

1 Answers1

7

-[UICollectionReusableView prepareForReuse] is the method. Here is the documentation for the method.

Carl Veazey
  • 18,392
  • 8
  • 66
  • 81