设置导航控件的标题
我将基于窗口的应用程序转换为基于导航的应用程序,但我无法设置导航栏的标题。
controller = [[bookDisplayViewController alloc] initAndCreateView];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
nav.title=@"Application";
[window addSubview:nav.view];
I converted window based application into navigation based but I am not able to set the title for the navigation bar.
controller = [[bookDisplayViewController alloc] initAndCreateView];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
nav.title=@"Application";
[window addSubview:nav.view];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将其放入
另一个视图的viewDidLoad中吗?我会尝试这种方式,看看它是否有效。
Is it possible for you to place
in the viewDidLoad of the other view? I'd try it that way and see if it works.
您必须在 UIViewController 中设置标题。试试这个:
事实上,苹果文档中 UINavigationItem 的“title”属性指出:
You must set the title from within the UIViewController. Try this:
Infact apple docs on UINavigationItem for the "title" property states that: