Modal View from multiple view controllers
I am trying to display a view modally. The view itself works just fine but I cannot get it to pop up in this situation only:
- TabBarController
- NavigationController
- TableViewController: I am trying to present it from this view, programatically, from the viewDidLoad method.
- otherViews...
This is how the standard code is (taken from apple, please correct me if wrong):
LoginView *loginView = [[LoginView alloc] initWithNibName:@"LoginView" bundle:nil];
U开发者_开发技巧INavigationController *loginNavigationController =
[[UINavigationController alloc] initWithRootViewController:loginView];
[self presentModalViewController:loginNavigationController animated:YES];
[loginNavigationController release];
[loginView release];
However I cannot get it to work. Even with
self.parentViewController presentM...
self.navigationController presentM...
self.tabbarController presentM...
Or multiple together...
Thank you for your help
Try pushing and see if it works. But as per your problem is concern try to debug your application and see if there is any object is nil or not. And in case you have tabbarController+NavigationController then you need to present from tabbarController or try getting topViewController from current navigationController and then present the view modally. Let me know if it works or not. If still it doesn't work send me your code by mail if you can I'll look into the issue.
Edit
One query - Do you want to push further viewController from the one you are trying to present modally?
精彩评论