开发者

How to customize the top bar of a UINavigationController with the current view information?

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:

  1. add the title
  2. customize "back" button text

Should I use self.navigationController method from the current UINavigationController ? If so, what are the next steps ?

Thanks

How to customize the top bar of a UINavigationController with the current view information?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜