UIViewController covering UINavigationBar
I have a UITabBarController with 2 items, where each item is pointing to a view controller of type Navigation Controller.
The second item is a login page to my web service.
A User that did not logged in will see a login page -> "LoginViewController".
If a user is already logged in, a different view will be there -> "LoggedViewController".
On Startup, in my AppDelegate i am checking if the user already logged or need to login and i change the views.
if (!logged) {
LoginViewController * nextView = [[[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil] autorelease];
NSMutableArray * tabBarRootViews = [[NSMutableArray alloc] initWithArray:self.tabBarController.viewControllers];
[tabBarRootViews replaceObjectAtIndex:1 withObject:nextView];
[sel开发者_StackOverflow社区f.tabBarController setViewControllers:tabBarRootViews animated:YES];
} else {
// Same if the user is logged only diff view
}
When the view is presented, It overlaps the UINavigationBar. I believe that the issue is that i am trying to replace a UINavigationController with a UIViewController, but i can't put my finger on the problem.
- Any idea how to solve it? (I want to see both the UITabBar and UINavigationBar and the UIViewController in the middle)
- Is that the correct way to change ViewControllers? Should i Use PresentModalView Instead?
Thanks!
I fixed it by keeping the UINavigationController as is and push a view controller according to the logged boolean.
精彩评论