Transferred from http://blog.csdn.net/ssrrxx111/article/details/48315843
1, the most common one of iOS layout, at the bottom of the tab navigation, control the different views.
2, the use of code to create Uitabbarcontroller.
1) in the Appdelegate
[HTML] view plain copy print? -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) LaunchOptions method, Create a new Uitabbarcontroller, and then create a new Uiviewcontroller or uitableviewcontroller that you want. Use these views as the root view of the Uinavigationcontroller. Use Method Initwithrootviewcontroller.
2 Set the Uitabbarcontroller Viewcontrollers property, here is an array, you can set the previous Uinavigationcontroller in the array.
3) Gets the Tabbar property of the Uitabbarcontroller. Then create multiple uitabbaritem corresponding to the above view. Sets the title and image of the Uitabbaritem, corresponding to the headings and images respectively.
In the Tabbarcontroller can only put 4 tab, if more than 4, then will automatically generate a more tab, and then put the Extra tab in the more corresponding Tableviewcontroller view.
The code to create Uitabbarcontroller using code is as follows:
[OBJC] View plain copy print? - (BOOL) Application: (uiapplication *) Application didfinishlaunchingwithoptions: (NSDictionary *) launchoptions { // Override point for customization after application launch. MainController *mainController = [[MainController alloc] init]; BaseNavigationController *mainNavCtl = [self initlizernavigationcontrollerwithrootviewcontroller:maincontroller]; maincontroller *maincontroller2 = [[maincontroller alloc] init]; basenavigationcontroller *mainnavctl2 = [self initlizerNavigationControllerWithRootViewController:mainController2];  &NBsp; maincontroller *maincontroller3 = [[ maincontroller alloc] init]; basenavigationcontroller * mainnavctl3 = [self initlizernavigationcontrollerwithrootviewcontroller:maincontroller3]; maincontroller *maincontroller4 = [[MainController alloc] init]; basenavigationcontroller  *MAINNAVCTL4 = [SELF INITLIZERNAVIGATIONCONTROLLERWITHROOTVIEWCONTROLLER:MAINCONTROLLER4] ; //settings Bottom tabbar UITabBarController *tab = [[UITabBarController alloc] init];     TAB.VIEWCONTROLLERS = @[MAINNAVCTL,MAINNAVCTL2,MAINNAVCTL3, mainnavctl4]; UITabBar *tabBar = tab.tabBar; uitabbaritem *tabbaritem1 = [tabBar.items objectAtIndex:0]; uitabbaritem *tabbaritem2 = [tabBar.items objectAtIndex:1]; uitabbaritem * tabbaritem3 = [tabbar.items objectatindex:2]; uitabbaritem *tabBarItem4 = [tabBar.items objectAtIndex:3];