Add gesture recognizer to the necessary image view:
UITapGestureRecognizer *frameTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(frameTapGesture:)];
[_imgView addGestureRecognizer:frameTapGesture];
Then in the gesture handler get access to the view gesture recognizer attached to:
- (void)frameTapGesture:(UITapGestureRecognizer*)sender
{
UIView *view = sender.view; //cast pointer to the derived class if needed
NSLog(@"%d", view.tag);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…