无法在Interface Builder下拉列表中看到自定义类 [英] Unable to see custom classes in Interface Builder drop down
本文介绍了无法在Interface Builder下拉列表中看到自定义类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Xcode 6.1.1,并且无法从下拉列表中选择我的自定义类。因此,我认为它引起了其他一些相关问题(见下文)。
I'm using Xcode 6.1.1, and cannot select my custom class from the drop down. Because of this, I believe it is causing several other related issues (see below).
症状:
- 当使用IB下拉列表选择自定义类时,不会显示任何自定义类。
-
IB_DESIGNABLE
和IBInspectable
不起作用:在IB中选择控件时,不会出现可设计状态;没有任何可检查的属性出现。选择定义为IB_DESIGNABLE
的视图时,调试选定视图选项显示为灰色。 - 按住Ctrl键拖动项目以创建连接(IBOutlet从IB到源代码的IBAction偶尔不允许你将连接丢弃到类的源代码中(好像存在类不匹配)。 (注意:这假设您在自定义类部分中手动键入类名。)
- 怀疑是相关的: WatchKit:无法找到接口控制器类
- When using the IB drop down to choose a custom class, none of the custom classes appear.
IB_DESIGNABLE
andIBInspectable
do not work: When selecting the control in IB, the "Designable" status does not appear; none of the inspectable properties appear either. Debug selected views option is grayed out when selecting a view which is defined asIB_DESIGNABLE
.- Ctrl-dragging items to create connections (IBOutlet and IBAction) from IB to source code occasionally doesn't allow you to "drop" the connection into the class's source code (as if there is a class mismatch). (Note: This assumes you manually typed in the class name in the Custom Class section.)
- Suspected to be related: WatchKit: unable to find interface controller class
我该如何解决这个问题?
How can I fix this?
推荐答案
有效的事情:
- 试试另一台机器。 (这让我相信机器有一些设置搞砸了。)
- 重新安装Xcode。
- 将项目移动到新位置(在这种情况下是一个git存储库),修复了一次。
我试过的东西不起作用(但有为其他人工作):
- 重新启动Xcode
- 重启机器(这个工作过一次)
- 创建一个新的故事板。
- 创建一个新的子类(不只是重命名)。
- 通过Apple的单一视图模板创建一个新项目。
- 清理项目
- 删除派生数据
- 重新索引项目
- 删除故事板文件上的本地化。
- Restart Xcode
- Restart machine (this worked once before, not this time)
- Create a new storyboard.
- Create a new subclass (not just rename it).
- Create a new project via Apple's single view template.
- Cleaning the project
- Deleting derived data
- Reindex the project
- Remove localization on the storyboard file.
我试过的东西不起作用:
Things I tried that didn't work:
- 根据Apple的约定命名子类(例如,而不是
View
使用ABCTestView
)。 - 在.h和.m中导入类的.h查看控制器。
- 试用另一个已经安装的Xcode版本(测试版6.2)。
- Naming the subclass according to Apple's conventions (e.g. instead of
View
useABCTestView
). - Import the .h of the class in the .h and .m of the view controller.
- Try on another version of Xcode, which is already installed (beta 6.2).
相关讨论:
- https://discussions.apple.com/thread/3054574?start=15&tstart=0
- Storyboard uiviewcontroller, 'custom class' not showing in drop down
这篇关于无法在Interface Builder下拉列表中看到自定义类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文