touchesBegan and other touch events not getting detected in UINavigationController
- by SaltyNuts
In short, I want to detect a touch on the navigation controller titlebar, but having trouble actually catching any touches at all!
Everything is done without IB, if that makes a difference.
My app delegate's .m file contains:
MyViewController *viewController = [[MyViewController alloc] init];
navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[window addSubview:navigationController.view];
There are a few other subviews added to this window in a way that overlays navigationController leaving only the navigation bar visible.
MyViewController is a subclass of UIViewController and its .m file contains:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch *touch in touches) {
NSLog(@"ended\n");
}
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UITouch *touch in touches) {
NSLog(@"began\n");
}
}
I also tried putting these functions directly into app delegate's .m file, but the console remains blank.
What am I doing wrong?