Why does UINavigationBar steal touch events?

I noticed that if you set userInteractionEnabled to OFF, the NavigationBar doesn’t “steal” the touches anymore.

So you have to subclass your UINavigationBar and in your CustomNavigationBar do this:

-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

    if ([self pointInside:point withEvent:event]) {
        self.userInteractionEnabled = YES;
    } else {
        self.userInteractionEnabled = NO;
    }

    return [super hitTest:point withEvent:event];
}

Info about how to subclass UINavigationBar you can find here.

Leave a Comment