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?
-[UICollectionReusableView prepareForReuse]
is the method. Here is the documentation for the method.