How to add uitabbarcontroller as a subview in UIViewController
I am new to iPhone development... Now I am trying to build an application in which the user is first shown a login screen. In this view there is no navigation control .
Once the user logged in, i want to show a new view, which has tabbar control. Based on the tab item selected in the tabbar ... the view being show could have just a table view or table view + navigationbar control.
Any help on this could be done ?
I am able build a small application to login screen and validate user credentials .. Also a different application where i build a tabbarviewcontroller and show associate various views to the each of the tabbar item.
But not sure to combine the both.So the problem is that i don’t know how to add the UITabbarController as a second view
Please help me 开发者_如何学编程on this.
You need to do something like this. remove the login view from main window and tabbarcontroller's view to the main window. You just need to implement some methods in application delegate class.
add tabbatcontroller to ur mainwindow class. whenever you need tabar in app. just remove UINavigationController and add UITabBarController.
or add add tabbatcontroller to ur mainwindow class and just present tababrcontroller from current viewcontroller.
AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
delegate.tCtr.selectedIndex = index;
delegate.tCtr.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:delegate.tCtr animated:YES];
精彩评论