UITabBarController Test

来源:互联网 发布:超级助手软件最新版 编辑:程序博客网 时间:2024/05/06 11:11

  

   //在AppDelegate.cpp中实现

    subViewController *subView =  [[subViewController alloc]init];

    UITabBarItem  *sbuViewBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:0];
   
    UINavigationController *subViewNav = [[UINavigationController alloc]initWithRootViewController:subView];
     subViewNav.tabBarItem = sbuViewBarItem ;
    
    test1ViewController *test1View = [[test1ViewController alloc]init];
    
    UINavigationController *test1Nav = [[UINavigationController alloc]initWithRootViewController:test1View];
    
    UITabBarItem *rightBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:0];
    test1Nav.tabBarItem = rightBarItem;
    
    UITabBarController *barController = [[UITabBarController alloc]init];
    
    
    barController.viewControllers = [NSArray arrayWithObjects:subViewNav ,test1Nav , nil] ;
    
    
    [self.window setRootViewController:barController];

原创粉丝点击