【发布时间】:2012-02-11 05:58:38
【问题描述】:
我尝试以编程方式创建标签栏控制器,它可以工作,但我无法将标题设置为 ta 栏项目。运行应用程序时看不到标题。我的代码在这里。请帮帮我,什么问题?
- (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;
}
【问题讨论】:
标签: objective-c ios xcode uitabbarcontroller uitabbaritem