什么时候为自定义视图创建Interface Builder插件? [英] When to create Interface Builder plug-in for custom view?

查看:163
本文介绍了什么时候为自定义视图创建Interface Builder插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您建议什么时候使用插件将自定义视图集成到Interface Builder中?当通过Apple的 Interface Builder插件编程指南我发现:

When do you recommend integrating a custom view into Interface Builder with a plug-in? When skimming through Apple's Interface Builder Plug-In Programming Guide I found:



  • 您的自定义对象是否只能由一个应用程序使用?

  • 您的自定义对象是否依赖于只在您的应用程序中找到的状态信息?
  • 将自定义视图封装在独立库或框架中会有问题吗?

这回答了我的一些问题,但我仍然想你的想法,当它是一个好主意。有什么好处和时间投资有多大呢?

That answers some of my questions, but I would still like your thoughts on when it's a good idea. What are the benefits and how big of a time investment is it?

推荐答案

将应用程序使用的视图和控制器类推送到单独的框架中是完全合理的

It's perfectly reasonable to push the view and controller classes that your application uses out into a separate framework — embedded in your application wrapper — for which you also produce an Interface Builder plug-in.

在其他原因中,您的应用程序中常用的类可以在其使用点进行配置Interface Builder,而不是分散的 -awakeFromNib 实现。这也是你可以让你的对象暴露可以在Interface Builder中设置的绑定的唯一方法。

Among other reasons, classes that are commonly used in your application can then be configured at their point of use in Interface Builder, rather than in scattered -awakeFromNib implementations. It's also the only way you can have your objects expose bindings that can be set up in Interface Builder.

这是一个编码,但是对于视图和控制器类在多个地方使用,并且在实际使用之前需要额外的设置,您可能会节省一大堆时间。你使用自己的控制器和视图类开发的经验将像Cocoa的开发。

It's a bit of coding, but for view and controller classes that are used in more than one place, and which require additional set-up before they're actually used, you'll probably save a bunch of time overall. And your experience developing with your own controller and view classes will be like developing with Cocoa's.

这篇关于什么时候为自定义视图创建Interface Builder插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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