Reputation: 7641
My storyboard looks like this:
The first part works prefect, the problem is that when I use the "Test Modal" button to modally show the second NavigationController, that is correctly set up to have a rootViewController - the connection is not being made.
Meaning, I know the UINavigationController is there (with querying all controllers starting from the UIWindow's rootViewController), and my controller is also loaded, but navigationController is nil, parentViewController is nil - there's no way I could access the UINavigationController (and thus no way to customize the top toolbar)
If I check the "Is Initial View Controller" on the second UINavigationController, it works (but obviously that's not what I want). I believe this might be a UIKit bug. Or am I doing it wrong?
Upvotes: 1
Views: 2284
Reputation: 7641
I've finally found this one out.
I WASN'T CALLING [super initWithCoder:decoder]
in my init. This left some UIViewController variables uninitialized. After changing that it works like a charm.
Upvotes: 2
Reputation: 86
Did implement your prepareForSegue method correctly? This is how I implement my prepareForSegue method in my apps.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"yourConnectionName"]) {
UINavigationController *navController = segue.destinationController;
YourViewControllerClass *controller = (YourViewControllerClass *)navController.topViewController;
controller.delegate = self;
}
}
Upvotes: 4