I have placed a UIGestureRecognizer deep within my uiview hierarchy but it is not being trigger. Here is a general map of the views:
UIScrollView > UIView > UIView > UIView > UIView
The last view has the gesture recognizer:
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.userInteractionEnabled = TRUE;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
[self addGestureRecognizer:tap];
[tap release];
}
return self;
}
- (void)tap:(UIGestureRecognizer *)recognizer {
NSLog(@"tap");
}
I am setting the canCancelContentTouches
of the scrollview to allow gestures to propagate through.
When I moved the view with the gesture to directly underneath the scrollview it works. Can someone explain why it does not work in a deep hierarchy?
Thanks!