self.title sets navigationController and tabBarItem's title? Why?

后端 未结 4 1564
孤城傲影
孤城傲影 2020-11-30 19:15

I do this in a UIViewController for one of my tabs:

self.title = @\"Welcome\";

However, it\'s overwriting whatever I have for the tabBarIte

4条回答
  •  再見小時候
    2020-11-30 19:54

    I was also facing the same issue, but i solve this issue like this. I set the title and image of tabBarItem right after i created them in appDelegate.

    This is what i have done:

    [viewController setTitle:@"controllerTitle"];
    [[viewController tabBarItem] setTitle:@"Custome Title for tab"];
    [[viewController tabBarItem] setImage:[UIImage imageNamed:@"tab.png"]];
    

提交回复
热议问题