已加载笔尖但未设置“查看"插座 [英] Loaded nib but the 'view' outlet was not set

查看:28
本文介绍了已加载笔尖但未设置“查看"插座的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中添加了一个新的 nib 文件,并尝试加载它.

I added a new nib file to my project, and tried to load it.

但是,当我点击应该带我进入我创建的视图的工具栏图标时,我收到一个带有消息的 NSInternalInconsistencyException:

However, when I click on the toolbar icon that is supposed to take me to the view that I created, I get an NSInternalInconsistencyException with the message:

由于未捕获的异常而终止应用'NSInternalInconsistencyException',原因:'-[UIViewController_loadViewFromNibNamed:bundle:] 加载了..."笔尖,但未设置视图插座.'

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "..." nib but the view outlet was not set.'

所以我打开了我的 nib 文件,我看到没有设置引用插座的视图.但是,我尝试单击并将新引用出口"的圆圈拖动到文件的所有者,但它不会让我...我需要做什么才能显示我的视图?

So I opened up my nib file, and I see for the view that there are no referencing outlets set. However, I try to click and drag the circle for "new referencing outlet" to File's Owner, but it won't let me...what do I need to do to get my view to display?

推荐答案

这对我有用:

  • 打开导致问题的 XIB 文件
  • 点击左侧栏上的文件所有者图标(顶部一个,看起来像一个黄色的框)
  • 如果您没有看到右侧边栏,请单击查看"上方的第三个图标;在您的工具栏中.这将显示右侧边栏
  • 在右侧边栏中,点击第四个标签——看起来有点像报纸的标签
  • 在自定义类"下在顶部,确保 Class 是应与此视图对应的 ViewController 的名称.如果没有,请输入
  • 在右侧边栏中,单击最后一个选项卡 - 看起来像带有箭头的圆圈的选项卡
  • 您应该会看到奥特莱斯"带有视图"在它下面.将旁边的圆圈拖到视图"上.左侧栏上的图标(底部一个,看起来像一个带有粗灰色轮廓的白色方块
  • 保存xib并重新运行

这篇关于已加载笔尖但未设置“查看"插座的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆