I am trying (from my 3rd child in the heirachy) to load the root view with the following. This does not work and I get the following error when the below code is run.
-[DetailViewController clickButton:]: unrecognized selector sent to instance 0x1161e00'
Code:
MapViewController *dvController = [[MapViewController alloc] initWithNibName:@"MapView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;
This exact same code works on other views, any idea how to debug this.
The code you wrote to create the MapViewController and push it onto the view controller stack is correct.
The unrecognized selector error is telling you that you are sending are attempting to call a method (named clickButton:) that does not exist.
I would suspect a spelling error. I take it that you most likely have a button defined that calls the code to create the new view. The method should look like this:
I would check that you have the “:(id) sender” part. I have made the mistake before of implementing a -(void) clickButton {} method, but had the message actually sending a parameter as well.