UINavigationController 跳过弹出窗口
我有 3 个视图控制器,一个是根,它推动下一个,后者推动下一个。每次您都可以使用默认显示的普通后退按钮返回(弹出)。
但是,当第三个视图可见时,当用户点击后退按钮时,我需要它跳过第二个视图控制器,并直接转到(弹出)根视图控制器。
如何覆盖默认的后退按钮行为? (我想保留后退按钮的形状,而不是将其替换为方形条按钮)
I have 3 view controllers, one is the root, which pushes the next, which pushes the next. Each time you can go back (pop), using the normal back button that appears by default.
However when the 3rd view is visible, when the user taps the back button I need it to skip out the the 2nd view controller, and go (pop) directly to the root view controller.
How can I override the default back button behaviour? (I'd like to keep the shape of the back button, and not replace it with a square bar button)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试让对象实现 UINavigationControllerDelegate 并强制执行此行为。您还可以让设计师创建相同大小和形状的资源,并且您可以将其用作按钮的背景。
但是,如果您确实需要这样做,我会重新考虑您的用户界面。这与用户对导航控制器应如何工作的期望相反。
You could try to have an object implement UINavigationControllerDelegate and enforce this behavior. You could also have a designer create the same size and shape asset and you could use this as the background for a button.
However, I'd rethink your UI if you really need to do this. It is contrary to the user's expectations of how a navigation controller should work.