UITapGestureRecognizer not starting when deep browsing hiearchy

I placed the UIGestureRecognizer deep in my uiview hierarchy, but this is not a trigger. Here is a general view map:

UIScrollView> UIView> UIView> UIView> UIView

The last view has a 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 set the canCancelContentTouchesscroll bar to allow gesture wrapping.

When I moved the view with a gesture directly under the scrollview, it works. Can someone explain why it does not work in a deep hierarchy?

Thank!

0
source share
1 answer

, , . , , . ..

, hittest, , , .

0

All Articles