xcode 将自定义对象添加到对象库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7016414/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:42:15  来源:igfitidea点击:

Adding custom objects to object library

xcodeinterface-builder

提问by Arcadian

How do I add custom objects to the custom object library in xcode?

如何将自定义对象添加到 xcode 中的自定义对象库?

I created a class myObject and I want this new object to appear in my object library list for use with IB.

我创建了一个类 myObject 并且我希望这个新对象出现在我的对象库列表中以与 IB 一起使用。

回答by PengOne

This is not a direct answer, but if your custom object is a subclass of something else, e.g. NSObjector UIView, etc, then you can simply select the parent object and then change the identity to your subclass with the attributes window.

这不是直接的答案,但如果您的自定义对象是其他对象的子类,例如NSObjectUIView等,那么您只需选择父对象,然后使用属性窗口将标识更改为您的子类。

If you want a direct answer, then read this post: How do you display custom UIViews in InterfaceBuilder?for instructions to create a plug-in for Interface Builder that uses your custom class.

如果您想直接回答,请阅读这篇文章:如何在 InterfaceBuilder 中显示自定义 UIView?有关为使用自定义类的 Interface Builder 创建插件的说明。

回答by Aspelund

Xcode 4 doesn't support IB plug-ins anymore. You're out of luck. (This is a direct quote from a comment of one of the answers to How do you display custom UIViews in InterfaceBuilder?)

Xcode 4 不再支持 IB 插件。你倒霉了。(这是对如何在 InterfaceBuilder 中显示自定义 UIViews的答案之一的评论的直接引用