Iphone tabBarItem';他的头衔没有';不出现
我在视图控制器中使用选项卡栏,并在“viewDidLoad”方法中声明它:Iphone tabBarItem';他的头衔没有';不出现,iphone,uitabbarcontroller,uitabbaritem,Iphone,Uitabbarcontroller,Uitabbaritem,我在视图控制器中使用选项卡栏,并在“viewDidLoad”方法中声明它: normalView =[[NormalViewController alloc] initWithSigne:[[normalAstro objectAtIndex:signIndex]objectForKey :@"name"] andDescription:[[normalAstro objectAtIndex:signIndex]objectForKey :@"description"]] ; [con
normalView =[[NormalViewController alloc] initWithSigne:[[normalAstro objectAtIndex:signIndex]objectForKey :@"name"] andDescription:[[normalAstro objectAtIndex:signIndex]objectForKey :@"description"]] ;
[controllers addObject:normalView];
chineseIndex=[self searchChineseIndex];
chineseView =[[ChineseViewController alloc] initWithSigne:[[chineseAstro objectAtIndex:chineseIndex]objectForKey :@"name"] andDescription:[[chineseAstro objectAtIndex:chineseIndex]objectForKey :@"description"]] ;
[controllers addObject:chineseView];
tabBar = [[UITabBarController alloc] init];
tabBar.viewControllers=controllers;
[self.view addSubview:tabBar.view ];
放置在选项卡栏中的viewControllers,我写这个来初始化它们:
[self.tabBarItem setTitle:@"signe astral" ] ;
问题是tabBarItem的标题没有出现在我面前,所以我的问题是,我的错误在哪里?使用
self.title = @"signe astral";
要设置UIViewController的标题,而不是在
self.tabBarItem
上,只需重新设置
self.title = @"signe astral";
如果要在选项卡栏中显示标题和图像。所以你必须使用这个代码
UIImage *img = [UIImage imageNamed:@"sss.png"];
self.tabBar = [[[UITabBarItem alloc] initWithTitle:@"signe astral" image:img tag:1] autorelease];
谢谢。我发现了相反的结果-当我尝试设置控制器标题时,它将以空白结束,但当我设置
选项卡项
标题时,它会正常工作,所以我做了更多的调查。如果同时设置了self.title和self.tabBarItem.title,则不显示任何标题。这两个属性都可以通过interface builder进行设置,这让事情变得更加混乱,多亏了否决票。这是一年前对丁瓜的回答。如果你需要帮助,你应该发布你的代码,而不是否决一个可行的解决方案。