I've a UINavigationControlle开发者_高级运维r and in the picture you can see a UIViewController added to it.
Now, I would like to customize the top bar of the UINavigationController with the content of the current visible UIViewController. More in particular, I would like:
- add the title
- customize "back" button text
Should I use self.navigationController method from the current UINavigationController ? If so, what are the next steps ?
Thanks
You can set the Title with:
[[self navigationItem] setTitle:@"title text"];
You can change the backbuttontext in the InterfaceBuilder or:
[[[self navigationItem] backBarButtonItem] setTitle:@"back button text"];
But remember that the backBarButtonItem comes from the previous ViewController so you have to set it there. Alternatively the title is set from the previous view.
self.title = "Your title";
You can use this in the current view controller for displaying title
精彩评论