如何更改页面标题而不更改标签栏项目的标题?

问题描述:

我希望能够在不影响标签栏标题的情况下更改页面标题。我目前的执行情况如下:如何更改页面标题而不更改标签栏项目的标题?

//Setting page and UITabbar title in app delegate 
ForYouViewController *fuvc = [[ForYouViewController alloc]init]; 
fuvc.title = @"Questions"; 
UITabBarItem *tempTabBarItem1 = [[UITabBarItem alloc]initWithTitle:@"Questions" image:nil tag:QUESTIONTAB_INDEX]; 

点击问题标签

enter image description here

//After changing the title's page in view did load of "ForYouViewController" 
- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.title = @"Latest"; 
} 

上单击问题选项卡后前(标签栏标题更改)

enter image description here

如何我可以设置页面标题,使其不会改变标签栏的描述吗?

你可以试试,如果`title`设置视图控制器之前,这就是所谓的这个

YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate]; 

[appDelegate tempTabBarItem1] setTitle:@"Questions"]; 
+0

潜在问题,为栏项目的冠军将通过制定者'title'会被替换。通过覆盖'-title'来提供标题可能是一个好主意。 –