Presenting modal view controller from popover
I have a view controller that is inside a popover, and I want to present a modal view controller from it. Here's my code:
EditDateViewController *dateViewController = [[EditDateViewController alloc] initWithNibName:@"EditDateViewController" bundle:[NSBundle mainBundle]];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:dateViewController];
navController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:navController animated:YES];
[dateViewController release];
[navController release];
The result is this:
alt text http://cl.ly/5300e4f8f5d440d3f850/content
For some reason, the navigation bar background is transparent (or black?) even though I did not configure it that way. I tried manually setting the tin开发者_如何转开发tColor
property of the navigation bar in the viewDidLoad
method of the modal view controller, but it had no effect.
Try this
dateViewController.modalInPopover=YES;
self.navigationController.modalInPopover=YES;
精彩评论