UINavigationController 的问题
我在我的应用程序中使用 UINavigationController。当“返回”时,我想跳过一个视图。我目前正在做的是这样的:
在我不想看到的视图的 viewDidAppear 中,我检查它是否是通过后退按钮单击出现的,如果是的话,我会调用:
[self.navigationController popViewControllerAnimated:YES];
但是会发生这样的情况:
不需要的视图和前一个视图变成一个视图(一个视图位于另一个视图之上)。
更多解释:
不需要的视图是第二个视图,我想转到根视图: 我使用的另一个代码是:
[self.navigationController popToRootViewControllerAnimation:YES]
这种方法的问题是 2: a) 我仍然在导航栏中看到一个我不应该看到的后退按钮 b) 应该有的工具栏项目不存在。 (不过,工具栏本身就在那里!)
任何人都可以让我知道我在这里做错了什么吗?谢谢。
I am using UINavigationController in my app. While going "Back" I want to skip one view. What I am currently doing is this :
In the viewDidAppear of the view I don't want to see I check to see if it appeared from a back button click, if so I call :
[self.navigationController popViewControllerAnimated:YES];
But what happens is this:
the unwanted view and the previous view get morphed into one view (one on top of the other).
more explanation:
the unwanted view is the 2nd view and I want to go to the rootview:
Another code that I used was:
[self.navigationController popToRootViewControllerAnimation:YES]
The problem with this approach is 2:
a) I still get a back button in the navigation bar that I should not be getting
b) The toolbar items that should be there are not there. (the toolbar itself is there, though!)
Can anyone kindly let me know what I did wrong here ? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试以下操作:
请记住 count 是一个从 0 开始的数组,因此只需执行 count - x 即可,同时考虑到这一点。
我也很确定这会起作用,但看起来不干净:
希望有帮助。
You can try this:
Keep in mind the count is an array starting at 0 so just do count - x, taking that into consideration.
Also I am pretty sure this would work but it doesn't look clean:
Hope that helps.
为了解决这个问题,我需要做的是::
从第三个视图和操作处理程序 popToRootViewController 中自定义后退按钮功能,
谢谢。
What I needed to do in order to sovle this problem was this ::
Customize the backbutton function from the 3rd view and in the action handler popToRootViewController
Thanks.