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

烂漫一生 提交于 2019-11-27 06:12:32

OK, I figured it out! Here's what I am doing:

self.title = @"Title for TabBarItem"; // TabBarItem.title inherits the viewController's self.title
self.navigationItem.title = @"Title for NavigationBar";

the navigationBar would inherit self.title, unless otherwise set using self.navigationItem.title

//set nav item title
self.navigationController.navigationBar.topItem.title = @"zurück";

this did it for me :=) (nothing of the above worked)

Try:

[self setTitle:@"Welcome"];

UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"Home" image:[UIImage imageNamed: image] tag:0];
[self setTabBarItem:item];
[item release];

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"]];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!