iphone sdk tabbar 查看插座未设置

发布于 2024-07-29 06:03:55 字数 389 浏览 1 评论 0原文

我对这个该死的项目已经束手无策了!!!!!!!

我有一个 UIViewController 类,它链接到一个笔尖,该笔尖有一个带有 2 个选项卡的选项卡栏控制器。 两个选项卡都会加载 nib 文件。 当我编译时,出现错误:

-[UIViewController _loadViewFromNibNamed:bundle:] 加载了“MainViewController”笔尖,但未设置视图出口

这里发生了什么? MainViewController 视图由 nib 文件填充(并且这些文件视图已正确链接)。MainViewController 的文件所有者有一个参数“view”,但由于我从 nib 加载两个视图,因此不应该忽略该参数吗? 任何帮助,将不胜感激!

I'm about at the end of my rope with this freaking project!!!!!!!

I have a UIViewController class that is linked to a nib that has a tabbar controller with 2 tabs. Both tabs load nib files. When I compile I get an error:

-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "MainViewController" nib but the view outlet was not set.

What's going on here? MainViewController views are being populated by nib files (and those files views are linked correctly).MainViewController's Files's Owner has a parameter "view" but shouldnt that be ignored since Im loading both views from a nib? ANY help would be appreciated!

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

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

发布评论

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

评论(3

奈何桥上唱咆哮 2024-08-05 06:03:55

我在调试器中遇到了同样的错误(加载了“xViewController”笔尖,但未设置视图出口。)。

在 Interface Builder 中,我打开 xViewController.xib,右键单击“视图”图标,从“新建引用出口”旁边的圆圈拖动到“文件所有者”图标,然后,当出现灰色小菜单时,单击“视图”。 (然后保存、重建、运行等...)

我不清楚发生了什么,但这解决了它。

据我了解,如果有人想跟进,则未设置视图的出口(名为“视图”),通过将新引用出口拖到文件所有者图标,我设置了视图的出口。 伟大的。

I had the same error (loaded the "xViewController" nib but the view outlet was not set.) in the debugger.

In Interface Builder, I opened the xViewController.xib, right-clicked the View icon, dragged from the circle beside New Referencing Outlet over to the File's Owner icon, then, when the small gray menu appeared, I clicked view. (Then save, rebuild, run, etc...)

I'm not clear on what's going on, but that fixed it.

From what I understand, if anybody wants to follow-up, the View's outlet (which is named "view") was not set, and by dragging the New Referencing Outlet over to the File's Owner icon, I set the View's outlet. Great.

稳稳的幸福 2024-08-05 06:03:55

问题#1 - nib 但未设置视图出口。
1. 我的 MainMenu.xib 具有 tabbarcontroller,它的文件所有者必须连接到某种视图。 所以放入一个视图对象并链接它就可以了。 我很生气,因为它一直显示该文件而不是选项卡栏。 #2 解决了这个问题

问题 #2 - 没有显示选项卡栏
2. 创建 IBOutlet UITabBarController 并将其链接到文件所有者。 然后在 viewdidload 方法中执行 self.view = tbController.view; 现在您的标签栏显示的不是您链接到的空白视图文件!

Issue #1 - nib but the view outlet was not set.
1. My MainMenu.xib that had the tabbarcontroller, it's File's owner MUST be connected to some sort of view. So putting in a view object and linking it is fine. I was getting annoyed because it kept showing that file and not the tabbar. #2 solves that problem

Issue #2 - no tabbar being shown
2. Create an IBOutlet UITabBarController and link that to the files owner. And then in the viewdidload method do this self.view = tbController.view; and now your tabbar is being shown not that blank view file you linked to!

傲娇萝莉攻 2024-08-05 06:03:55

您需要将每个外部笔尖的视图添加到主 xib,然后将视图出口连接到正确的视图。 例如,如果 MainMenu.xib 中有选项卡栏和名为 ViewOne.xib 的外部 xib,则打开它们,将自定义视图(或任何名称)从 ViewOne.xib 窗口拖动到 MainMenu.xib 窗口。 然后将该视图的选项卡的视图出口连接到自定义视图。 将自定义视图复制到 MainMenu.xib 后,您可能应该重命名它,以便将其与必须添加到 MainMenu.xib 的其他视图区分开来。

You need to add the view from each external nib to the main xib and then connect the view outlet to the correct view. For example, if you have the tab bar in MainMenu.xib and an external xib named ViewOne.xib then open both of them, drag Custom View (or whatever it's called) from the ViewOne.xib window to the MainMenu.xib window. Then connect the view outlet of the tab for that view to Custom View. You should probably rename Custom View once you copy it to MainMenu.xib so that can tell it apart from the other views you will have to add to MainMenu.xib.

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