UINavigationBar后退按钮不出现
我有一个导航栏,其标题上有一个 UIImage,如下所示:
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top_logo.png"]];
当我选择一行时,不会出现“后退”按钮。为什么?
我在其他视图控制器上有完全相同的代码,并且它出现了。 我不明白为什么...
谢谢,
RL
I have a navigationBar, with a UIImage on it's title, like this:
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top_logo.png"]];
When i select a row, the "back" button does not appear. Why?
I have the exact same code on other's viewControllers, and it appears.
I don't understand why...
Thanks,
RL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您在堆栈上的前一个视图控制器(父 VC)中设置了 self.navigationItem.title 或 self.title 或显式创建了 UIBarButtonItem,否则后退按钮不会出现 并将其设置为堆栈上前一个视图控制器(父 VC)中的
self.navigationItem.backBarButtonItem
。The back button won't appear unless you've set
self.navigationItem.title
or 'self.title' in the previous view controller on the stack (parent VC) or explicitly created aUIBarButtonItem
and set it toself.navigationItem.backBarButtonItem
in the previous view controller on the stack (parent VC).您是否通过导航堆栈推送新视图?
例如:
[self.navigationController PushViewController:viewControllerToPush动画:YES];
did you push the new view through the navigation stack?
like:
[self.navigationController pushViewController:viewControllerToPush animated:YES];