UINavigationController with presentModalViewContro

2019-02-15 15:40发布

问题:

I have a menu screen that implements UINavigationController and on top of that screen, using presentModalViewController, I place another screen on which I want to have another UINavigationController. I have tried to implement another navigation controller to handle the new screen but I either get a navbar 1/8th the way down the screen and it crashes or nothing at all. I have tried [[UINavigationController alloc] initWithRootViewController:navigationConroller] with no success as well. I'm just using pushViewController to try and place the next nib on the stack which doesn't work. What am I doing wrong?

回答1:

Although there are a lot of people saying on forums that Apple doesn't allow this I have got it to work. What you have to do is:

Map *mapScreen = [[[Map alloc] init] autorelease];
mapScreen.delegate = self;

UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:mapScreen] autorelease];

[self presentModalViewController:navController animated:YES];