You are setting both the Tap Gesture Objects on [self view]
object.
Also, the UIImageView
object, lets call it imageObj
, should have userInteractionEnabled = YES
.
instead of:
[[self view] addGestureRecognizer:tapGestureRecognizerImage];
you should do:
[imageObj setUserInteractionEnabled:YES];
[imageObj addGestureRecognizer:tapGestureRecognizerImage];
You generally use -addGestureRecognizer:
on the object you want your gesture object to work on.
Say you have a UITapGestureRecognizer
object called myTapGesture
.
Then, to make it work...
- on a
UILabel *lblSomeObj
it will be:[lblSomeObj addGestureRecognizer:myTapGesture];
- on a
UIView *vwSomeObj
it will be:[vwSomeObj addGestureRecognizer:myTapGesture];
- etc...