Then when you implement your imageViewClicked
method, you can get the tapped ImageView using the view
property of the GestureRecognizer. Starting from that, you can for example:
- use the tag of your imageView (if you affected it in your
tableView:cellForRowAtIndexPath:
method) to retrieve the tag and do whatever you want with it (depending on what you affected it to, for example you may have setimageView.tag = indexPath.row
intableView:cellForRowAtIndexPath:
and get that indexPath row back then) - Go thru the superviews of the imageView up to the UITableViewCell, then ask for its indexPath to get it back and do whatever you want with it.
Example:
-(void)imageViewClicked:(UITapGestureRecognizer*)gestRecognizer { UIImageView* iv = (UIImageView*)gestRecognizer.view; NSInteger tag = iv.tag; // then do what you want with this // or get the cell by going up thru the superviews until you find it UIView* cellView = iv; while(cellView && ![cellView isKindOfClass:[UITableViewCell class]]) cellView = cellView.superview; // go up until you find a cell // Then get its indexPath UITableViewCell* cell = (UITableViewCell*)cellView; NSIndexPath* indexPath = [self.tableView indexPathForCell:cell]; }