Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

self.title = @"Welcome";

However, it's overwriting whatever I have for the tabBarItem. I have tried:

self.tabBarItem.title = @"Home";

and

[self.tabBarItem initWithTitle:@"Home" image:[UIImage imageNamed:@"iconHome.png"] tag:0];

But still, self.title overwrites the tabBarItem, regardless of whether I am trying the two latter pieces of code after the title has been set. The code even runs without errors, but the self.tabBarItem.title or initWithTitle doesn't do anything?

like image 557
runmad Avatar asked Oct 08 '09 21:10

runmad


2 Answers

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

like image 157
runmad Avatar answered Sep 22 '22 09:09

runmad


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

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

like image 36
cV2 Avatar answered Sep 19 '22 09:09

cV2