我尝试以编程方式创建标签栏控制器,它的工作原理,但我无法将标题设置为ta栏项目。当我运行我的应用程序时,我看不到标题。我的代码在这里。请帮助我,这是什么问题?标签栏项目标题以编程方式不显示在目标c中
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
myTabBarController = [[UITabBarController alloc] init];
view2Controller = [[testView alloc] init];
view3Controller = [[testView2 alloc] init];
view4Controller = [[testView3 alloc] init];
view5Controller = [[testView4 alloc] init];
view6Controller = [[testView5 alloc] init];
myTabBarController.viewControllers = [NSArray arrayWithObjects: view2Controller, view3Controller,view4Controller,view5Controller,view6Controller,nil];
UITabBarItem *tabItem = [[[myTabBarController tabBar] items] objectAtIndex:1];
[tabItem setTitle:@"theTitle"];
[self.view addSubview:myTabBarController.view];
myTabBarController.selectedIndex=0;
}
我试试这个,但不行还是:( – 2012-01-16 09:39:27
我在'viewDidLoad'设置它,但它没有工作,但在'viewWillAppear中:'运行良好感谢 – Gonzo 2015-03-06 21:52:48