UINavigationController和UITabBarController合用。

来源:互联网 发布:淘宝如何购买凤楼信息 编辑:程序博客网 时间:2024/04/28 23:10
  1. FirstViewControlle *firstViewControlle = [[FirstViewControlle alloc] init];  
  2.     UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController: firstViewControlle];  
  3.     UITabBarItem *time = [[UITabBarItem alloc] initWithTitle: @"First" image: nil tag: 0];  
  4.     nav1.tabBarItem = time;  
  5.       
  6.     SecondViewController *secondViewController = [[SecondViewController alloc] init];  
  7.     UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController: secondViewController];  
  8.     UITabBarItem *time2 = [[UITabBarItem alloc] initWithTitle: @"second" image: nil tag: 1];  
  9.     nav2.tabBarItem = time2;  
  10.       
  11.     UITabBarController *tabBarController = [[UITabBarController alloc] init];  
  12.     NSArray *array = [NSArray arrayWithObjects: nav1,nav2, nil];  
  13.     tabBarController.viewControllers = array;  
  14.       
  15.     [self.window addSubview: tabBarController.view];  
0 0
原创粉丝点击