简体   繁体   English

iPhone-为Interface Builder创建自定义对象?

[英]iPhone - Creating custom objects for Interface Builder?

I am currently subclassing UIView to create custom objects, they work perfectly fine 我目前正在子类化UIView来创建自定义对象,它们工作得很好

In interface builder i drag and drop a uiview and I set the class name to my custom view, and in runtime the view will populate according to my code. 在界面构建器中,我拖放一个uiview并将类名设置为我的自定义视图,在运行时该视图将根据我的代码进行填充。

QUESTION: Is it possible to make it so that my custom view DRAWS in interface builder, And maybe drag and drop my custom view ? 问题:是否可以使我的自定义视图在界面生成器中拖动,或者拖放我的自定义视图?

I've researched this myself a while back, as far as i know this is not possible using the iPhone SDK. 就我之前所知,我已经知道使用iPhone SDK无法做到这一点。 When developing for the Mac SDK you can create your own IB plugins. 在为Mac SDK开发时,您可以创建自己的IB插件。

You need to add the custom view to the Interface Builder library. 您需要将自定义视图添加到Interface Builder库。 Go to File -> Read Class Files... in interface builder, and select your header file to add your item to interface builder's list. 转到界面构建器中的文件->读取类文件...,然后选择头文件以将您的项目添加到界面构建器的列表中。

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

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