I have an UICollectionView with custom cells. When I tap a cell I get a collectionView: didSelectItemAtIndexPath:.
This doesn't allow me to determine which element inside the cell was tapped (image or label). How to determine which element within the cell was tapped?
You have to subclass UICollectionViewCell and have these kind of objects in your UICollectioView. Then you create a delegate in the cells with methods like
- (void)collectionCell:(UICollectionViewCell *)cell didTapButtonWithIndex:(NSUInteger)index
and set your view controller as delegate for each of this cell. So you would get the action in these methods instead of collectionView: didSelectItemAtIndexPath:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With