UINavigationContlrol 不弹出视图

发布于 2024-10-01 01:22:18 字数 152 浏览 6 评论 0原文

我知道对此有一些疑问,但没有一个得到解答。

我的应用程序中有一个导航控制器。推送视图可以正常工作。按下后,后退按钮也可见,但是当我按下后退按钮时,它不会弹出视图,只会将导航栏的视图更改为预览的视图导航栏。

希望现在有人能给出答案。

提前致谢。

I know there are few questions about it but none of them was answered.

I have a navigation controller in my app. Pushing views works normally. After pushing, back button is also viewable but when i press the back button it does not pops the view, only changes the navigation bar's view to the preview's views navigation bar.

Hope someone has an answer now.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

闻呓 2024-10-08 01:22:18

您能提供一些推送内容的代码片段吗?您应该推送视图控制器,而不是视图。

UINavigationController 本质上是一个视图控制器容器,它管理一堆视图控制器。每个视图控制器包含一个视图。

Can you provide some code snippets of where you push things? You should be pushing view controllers, not views.

UINavigationController is a view controller container essentially which manages a stack of view controllers. Each view controller contains a view.

肤浅与狂妄 2024-10-08 01:22:18

我只花了三个小时解决这个问题。您的 xib 中的导航控制器很可能被搞乱了,并且该栏未“连接”到应用程序。

因此,在 IB 中,删除现有的导航控制器,然后从库中添加一个新的导航控制器。按住 Ctrl 键并从委托(而不是文件所有者)拖动到新的导航控制器上,然后选择委托的出口(您通常将其称为 navController 或 navigationController)。然后 apple-4 并将底层视图控制器(根视图控制器)的 Class 更改为主视图控制器的名称。如果该视图控制器有 nib/xib,请通过按 apple-1 并选择 NIB 来指定它。同样,这是针对视图控制器,而不是(父)导航控制器。保存并重新构建。

I just spent three hours solving this issue. More than likely your Navigation Controller in the xib is messed up and the bar is not "connecting" to the application.

So, in IB, delete the existing Navigation Controller, and add a fresh one from the Library. Ctrl-drag from the Delegate (NOT the File's Owner) and drop onto the new Navigation Conroller, and select the delegate's outlet (you usually call it navController or navigationController). Then apple-4 and change the Class of the underlying View Controller (Root View Controller) to the name of the main View Controller. If that view controller has a nib/xib, specify it by pressing apple-1 and choosing the NIB. Again, this is for the View Controller, not the (parent) Navigation Controller. Save and re-build.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文