The project has UIViewmyView and UIImageViewmyImage behind myView, a view hierarchy:
UIWindow
| - Hunting and fishing | - Hunting and fishing
Then added gesture recognizer in myImage in ViewController
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
tapGesture.numberOfTapsRequired = 1;
[myImage addGestureRecognizer:tapGesture];
But the gesture does not affect myImage, myImage has setUserInteractionEnabled:YES. This will only affect when myImage is placed in front of myView, how can I solve this problem?
source
share