我正在开发一个iphone应用程序,它在每个选项卡中都有一个带有UINavigationControllers的主视图控制器(UITabBarController)。问题是我无法更改TabBarItem的数据(标题和图像)。在UITabBarController中设置UINavigationController的UITabBarItem
这是我如何加载viewcontrollers:
AroundViewController *aroundViewController = [[AroundViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:aroundViewController];
[[navController navigationBar] setTintColor:[UIColor grayColor]];
UITabBarController *tabBarController = [[UITabBarController alloc] init];
NSArray *viewControllers = [NSArray arrayWithObjects:navController, nil];
[tabBarController setViewControllers:viewControllers];
[self presentViewController:tabBarController animated:YES completion:nil];
我试图设置在aroundviewcontroller的init的tabbaritem,但我没有成功。 我读,一个解决办法是,在init,
[self setTitle:@"whatever"];
这个工作,但我无法改变形象。
在此先感谢。
我在aroundviewcontroller的init [自tabBarItem]的setTitle:@ “CERCA”]尝试和没有工作 – Juanjo
但是[个体经营的setTitle :@“Cerca”]的作品,但我不能把这个图像 – Juanjo
再次嗨!查看编辑的答案。 –