设置导航项的标题
我在 titleView 中插入了一些视图,它位于 navigationItem 中,如下所示 self.navigationItem.titleView=someView;
在此之后我将其设置为 nil self.navigationItem.titleView=nil;
然后在此之后我无法将 navigationItem 中的标题设置为 [self.navigationItem setTitle:@"Title"];
。
那么我如何设置 navigationItem 的标题。请给我一些想法。
谢谢
I have inserted some view in titleView which is in navigationItem like this self.navigationItem.titleView=someView;
after this i set it as nil self.navigationItem.titleView=nil;
then after this i can't set title in navigationItem as [self.navigationItem setTitle:@"Title"];
.
so how can i set title for navigationItem.give me some idea.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的想法是正确的。根据文档,将 titleView 设置为 nil 应该会使标题文本出现。我敢打赌你的问题是在生命周期中你何时这样做。我相信在
viewWillAppear
中添加该代码就可以了。I think you have the right idea. According to the docs, setting the titleView to nil should make the title text appear. I would bet your issue is when in the lifecycle you do that. I believe adding that code in
viewWillAppear
would be fine.