navigationController标题 [英] navigationController title
问题描述
我正在使用带有导航控制器的应用程序。我知道在视图最初加载时如何设置标题。我推了一个新的视图控制器并设置了它的标题。现在的问题是,当我按下后退按钮时,原始视图控制器的标题不再存在。我试图做...
I am working on an app with a navigation controller. I know how to set the title when the view loads initially. I push a new view controller and set it's title. Now the problem is when I press the back button, the title for the original view controller is not there anymore. I tried to do...
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.title = @"Some Title";
}
虽然这没有设置标题。有人知道我能做什么吗?
This did not set the title though. Does anyone know what I can do?
推荐答案
UINavigationController从当前的UIViewController获取标题的值。
The UINavigationController gets the value for the title from the current UIViewController.
要设置视图控制器的标题,只需执行以下操作:
To set a the title for a view Controller, simply do the following:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Some Title";
}
对于每个View Controller,包括根控制器。
For each of your View Controllers, including the root one.
这篇关于navigationController标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!