iPhone Objective-C:使用导航控制器单击选项卡时禁用堆栈弹出
假设我有一个带有选项卡 A 的选项卡栏控制器。A 有一个导航控制器,它允许我将新视图推送到堆栈上。现在,如果我点击选项卡栏上的 A,A 堆栈中的所有元素都会弹出。
有没有一个好的方法来禁用这个?我有一系列与接受用户输入的导航控制器一起显示的视图,我不希望所有这些都随着手指的滑动而丢失。
预先感谢,如果我的问题不清楚,请告诉我。
Let's say I have a Tab Bar Controller with a tab A. A has a navigation controller, which lets me push new views onto the stack. Right now, if I tap A on the Tab Bar, all of the elements in A's stack will pop.
Is there a nice way to disable this? I have a sequence of views that are displayed with the navigation controller that takes user input would not like all of that to be lost with a slip of the finger.
Thanks in advance, and please let me know if my question is unclear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试为您的 UITabBarController 设置委托,并实现:
如果选择相同的视图控制器,则返回 NO。那么导航堆栈不应该改变。
请注意,它只会针对您从 iOS 3.0 开始使用的同一选项卡进行调用,但此时我只针对 iOS 3.0+。
Try setting up a delegate for your UITabBarController, and implement:
If the same view controller is being selected, return NO. Then the navigation stack should not change.
Note it will only be called for the same tab you are already on from iOS 3.0 on, but at this point I would only target iOS 3.0+.