首页 > 其他 > 详细

导航栏,标签栏的混搭使用

时间:2015-12-21 10:41:59      阅读:154      评论:0      收藏:0      [点我收藏+]

在AppDelegate里边实现

//各个标签栏ViewController的实例化   titile为标签栏标题

MainViewController *mainController = [[MainViewControlleralloc] init];

    mainController.title = @"大米先生";

    OrderViewController *orderController = [[OrderViewControlleralloc] init];

    orderController.title = @"发现";

    PersonalViewController *personalCntroller = [[PersonalViewControlleralloc] init];

    personalCntroller.title = @"我的";

    SettheZoneViewController *setthtzoneController = [[SettheZoneViewControlleralloc] init];

    setthtzoneController.title = @"订单";

//创建导航栏,并赋给ViewController,设置称为导航栏

    UINavigationController *naviga1 = [[UINavigationControlleralloc] initWithRootViewController:mainController];

    UINavigationController *naviga2 = [[UINavigationControlleralloc] initWithRootViewController:orderController];

    UINavigationController *naviga3 = [[UINavigationControlleralloc] initWithRootViewController:personalCntroller];

    UINavigationController *naviga4 = [[UINavigationControlleralloc] initWithRootViewController:setthtzoneController];

//导航栏标题设置  

  naviga1.tabBarItem = [[UITabBarItemalloc] initWithTitle:@"首页"image:niltag:2];

    naviga2.tabBarItem = [[UITabBarItemalloc] initWithTitle:@"发现"image:niltag:3];

    naviga3.tabBarItem = [[UITabBarItemalloc] initWithTitle:@"我的"image:niltag:4];

    naviga4.tabBarItem = [[UITabBarItemalloc] initWithTitle:@"订单"image:niltag:5];

    

    NSArray *viewArray = [[NSArrayalloc] initWithObjects:naviga1,naviga2,naviga3,naviga4,nil];

//标签栏创建    

    UITabBarController *tabbarController = [[UITabBarControlleralloc] init];

    tabbarController.viewControllers = viewArray;

    self.window.rootViewController = tabbarController;

导航栏,标签栏的混搭使用

原文:http://www.cnblogs.com/Pegboggs/p/5062451.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!