UITabBarController

来源:互联网 发布:java date timestamp 编辑:程序博客网 时间:2024/05/16 09:44
1.

@interface AppDelegate : UIResponder <UIApplicationDelegate>

{

    UITabBarController * tabBarController;

}


2.

    tabBarController = [[UITabBarControlleralloc]init];

    [self.windowsetRootViewController:tabBarController];

    

    FirstViewController * firstView = [[FirstViewControlleralloc]init];

    firstView.view.backgroundColor = [UIColorredColor];

    

    SecondViewController * secondView = [[SecondViewControlleralloc]init];

    secondView.view.backgroundColor = [UIColorblackColor];

    

    tabBarController.viewControllers = [NSArrayarrayWithObjects:firstView,secondView, nil];


    UITabBar * tabBar = tabBarController.tabBar;

    

    UITabBarItem * item1 = [tabBar.itemsobjectAtIndex:0];

    UITabBarItem * item2 = [tabBar.itemsobjectAtIndex:1];

    

    item1.title = @"item1";

    item2.title = @"item2";


0 0