如何在Xcode中为iPhone SDK构建自定义控件? [英] How build a custom control in Xcode for the iPhone SDK?

查看:136
本文介绍了如何在Xcode中为iPhone SDK构建自定义控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个自定义控件,以便在我的项目中重用,该项目由两个链接在一起的UITextField +一个标签组成。

I want to build a custom control to reuse in my project which consists of two UITextFields that are linked together + a label.

它开始变得重复我的应用程序和代码重复的气味;)

It is starting to become repetitive across my App and smells of code duplication ;)

但是,我想知道这里最好的方法是什么。

However, I wonder what is the best aproach here.

最好通过控制器中的代码执行所有操作,还是可以执行Xcode中内置的可视化操作?

Is it best do everything by code in a controller or is posible do a visual thing like the ones built-in in Xcode?

推荐答案

您可以为此构建一个Interface Builder插件。这是相当直截了当的。要开始使用,请阅读 Interface Builder Plug-In Programming Guide 。它甚至还有一个快速的分步教程,可以帮助您入门。 Apple建议您为IB创建一个插件...

You can build an Interface Builder plug-in for this. It's fairly straight-forward. To get started, read the Interface Builder Plug-In Programming Guide. It even has a quick, step-by-step tutorial to get you started. Apple recommends creating a plug-in to IB for just your case...

这篇关于如何在Xcode中为iPhone SDK构建自定义控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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