UINavigationContlrol 不弹出视图
我知道对此有一些疑问,但没有一个得到解答。
我的应用程序中有一个导航控制器。推送视图可以正常工作。按下后,后退按钮也可见,但是当我按下后退按钮时,它不会弹出视图,只会将导航栏的视图更改为预览的视图导航栏。
希望现在有人能给出答案。
提前致谢。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能提供一些推送内容的代码片段吗?您应该推送视图控制器,而不是视图。
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.
我只花了三个小时解决这个问题。您的 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.