29,028
社区成员
发帖
与我相关
我的任务
分享
self.title = @"第一页";
self.tabBarItem.image = [UIImage imageNamed:@"01"];
[self.view setBackgroundColor:[UIColor blueColor]];
UIViewController *viewController1 = [[ViewController1 alloc] initWithNibName:@"ViewController1" bundle:nil];
UIViewController *viewController2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
// 初始化选项卡控制器
self.tabBarController = [[UITabBarController alloc] init];
// self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController2,viewController1, nil];(用了两种写法)
self.tabBarController.viewControllers = @[viewController1,viewController2];
self.window.rootViewController = _tabBarController;