我有一个现有的iphone应用程序,它有一个导航控制器作为其根控制器。现在我必须在屏幕底部添加一个标签栏控制器。我怎样才能实现这一变化?
答案 0 :(得分:1)
首先你需要在根目录中创建标签栏控制器,然后为每个标签栏放置导航控制器或其他视图控制器
祝你好运答案 1 :(得分:1)
您是否要在标签中显示多个viewControllers? 将viewControllers添加到tabBar的viewControllers。使用此属性
tabBarController.viewControllers = view_Controllers_Array;
例如
NSMutableArray * viewControllers = [[NSMutableArray alloc]init];
FirstViewController * firstViewController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController * nvc = [[UINavigationController alloc] initWithRootViewController:firstViewController];
[firstViewController release];
[viewControllers addObject:nvc];
[nvc release];
SecondViewController * secondViewController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
nvc = [[UINavigationController alloc] initWithRootViewController:secondViewController];
[secondViewController release];
[viewControllers addObject:nvc];
[nvc release];
UITabBarController * tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = viewControllers;
[window addSubview:tabBarController.view];