首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UINavigationController跟UITabBarController合用

2012-12-17 
UINavigationController和UITabBarController合用。TabPage1 *firstViewControlle [[TabPage1 alloc] ini

UINavigationController和UITabBarController合用。

TabPage1 *firstViewControlle = [[TabPage1 alloc] init]; UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController: firstViewControlle]; UITabBarItem *time = [[UITabBarItem alloc] initWithTitle: @"First" image: nil tag: 0]; time.image = [UIImage imageNamed:@""]; nav1.tabBarItem = time; TabPage2 *secondViewController = [[TabPage2 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 presentViewController:tabBarController animated:YES completion:nil];///////////在TabPage1中self.navigationitem.title = @"111";

热点排行