导航控制器标题
我正在开发一个带有导航控制器的应用程序。我知道如何在视图最初加载时设置标题。我推送一个新的视图控制器并设置它的标题。现在的问题是,当我按下后退按钮时,原始视图控制器的标题不再存在。我尝试做...
- (void)viewWillAppear:(BOOL)animated {
self.navigationController.title = @"Some 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
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:
For each of your View Controllers, including the root one.
尝试更改导航项的标题。
Try changing the navigation item's title.
在 Swift 3 中:
或者如果您想自定义标题的详细信息:
in Swift 3:
or if you want to customize the details of the title:
尝试这样设置你的标题。
Try setting your title this way.