- FirstViewControlle *firstViewControlle = [[FirstViewControlle alloc] init];
- UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController: firstViewControlle];
- UITabBarItem *time = [[UITabBarItem alloc] initWithTitle: @"First" image: nil tag: 0];
- nav1.tabBarItem = time;
- SecondViewController *secondViewController = [[SecondViewController alloc] init];
- UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController: secondViewController];
- UITabBarItem *time2 = [[UITabBarItem alloc] initWithTitle: @"second" image: nil tag: 1];
- nav2.tabBarItem = time2;
- UITabBarController *tabBarController = [[UITabBarController alloc] init];
- NSArray *array = [NSArray arrayWithObjects: nav1,nav2, nil];
- tabBarController.viewControllers = array;
- [self.window addSubview: tabBarController.view];
UINavigationController和UITabBarController合用。
最新推荐文章于 2020-12-21 12:11:11 发布
本文介绍了一个使用 iOS UIKit 框架创建的简单 UITabBarController 示例。该示例包括两个 UINavigationController 实例,每个 UINavigationController 实例都有一个根视图控制器 (RootViewController),并且每个 UINavigationController 都被分配到了一个 UITabBarItem。
97

被折叠的 条评论
为什么被折叠?



