简体   繁体   English

侧面视图上的UINavigationController

[英]UINavigationController on the flipside view

I am having a problem with creating a navigation controller after on the other side of the application :) ... I mean after clicking this small info button and flipping on the other side ... 我在应用程序的另一边之后创建导航控制器时遇到问题:) ...我的意思是单击此小信息按钮并在另一边翻转后...

I'm getting this error:Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "InfoController" nib but the view outlet was not set.' 我收到此错误:由于未捕获的异常“ NSInternalInconsistencyException”而终止应用程序,原因:“-[UIViewController _loadViewFromNibNamed:bundle:]加载了“ InfoController”笔尖,但未设置视图出口。

And I know that the problem is somewhere in connecting the view outlet to the the view ... 而且我知道问题出在将视图出口连接到视图的某处...

Screenshot from my IB is here: 我的IB的屏幕截图在这里:

在此处输入图片说明

I will appreciate any help as this is the last piece of my app I need to finish ... 我将不胜感激,因为这是我需要完成的应用程序的最后一部分...

UIViewController has a ivar called view. UIViewController有一个称为视图的ivar。 If it is not connected in IB (or set in code), you'll get this message. 如果未在IB中连接(或未在代码中设置),则会收到此消息。 In IB, click on "File's Owner", then click on the "Connections" tab in the Inspector. 在IB中,单击“文件的所有者”,然后在检查器中单击“连接”选项卡。 Under "Outlets" what is the "view" parameter connected to? 在“插座”下,“视图”参数连接到什么? It needs to be connected to the view you intend to control from your InfoController. 它需要连接到要从InfoController控制的视图。

That being said, there is some inconsistency in what you are showing in your screenshot. 话虽如此,您在屏幕快照中显示的内容存在一些不一致之处。 Normally, you won't have a UINavigationController be part of your UIViewController xib. 通常,您不会让UINavigationController成为UIViewController xib的一部分。 Instead, it should be in your MainWindow.xib. 相反,它应该在您的MainWindow.xib中。 You can try to drag a connection from your File's Owner to the view inside of your navigation controller, but I don't think that will work. 您可以尝试将文件所有者的连接拖动到导航控制器内部的视图中,但是我认为这不起作用。 You'll have to move the navigation controller to your MainWindow.xib and then set it's view to be of type InfoController using xib InfoController. 您必须将导航控制器移至MainWindow.xib,然后使用xib InfoController将其视图设置为InfoController类型。

If this is unclear, create a new project using the "Navigation-based Application" template in Xcode. 如果不清楚,请使用Xcode中的“基于导航的应用程序”模板创建一个新项目。 Then open the MainWindow.xib file in IB. 然后在IB中打开MainWindow.xib文件。 You'll see in there how the navigation controller should be set up. 您将在其中看到如何设置导航控制器。

You'll get more visibility on this question if you add 'iphone' as a tag, by the way. 顺便说一句,如果您添加“ iphone”作为标签,您将在这个问题上有更多的了解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM