Hey guys i have a a UIViewController, RootUIViewController referencing another UIViewcontroller, MainMenuViewController.
Im adding MainMenuViewController's view as a subview to RootUIViewController's view. The problem is touch events are not being caught in MainMenuViewController touchesBegan method.
Relevant code is below. The output when touching the screen show "touched at root view controller". The desired result i want is the touch event to be caught in the MainMenuViewController and display "touched at root view controller". What am I missing/ doing wrong here?
RootUIViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
MainMenuViewController* mainMenuViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuView" bundle:nil];
m_mainMenuViewController = mainMenuViewController;
[self.view addSubview:m_mainMenuViewController.view];
[mainMenuViewController release];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSLog(@"touched at root view controller");
}
MainMenuViewController.m
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSLog(@"touched at main view controller");
}
userInteractionEnabled
ofm_mainMenuViewController.view
is set toNO
. – Deepak Danduprolu