开发者

IOS: Create a reusable UI widget that can be used in Interface Builder?

IOS: Create a reusable UI widget that can be used in Inte开发者_运维问答rface Builder? How do you create an element that can be used in other forms?


All you need to do is make a subclass of your object, let's say UIButton for instance.

Custom Object:

@interface MyCustomButton : UIButton 
{
    UIColor *tintColor;
}
@property (nonatomic,retain) UIColor *tintColor;
@end

Your Class:

#import "MyCustomButton.h"
@interface MyViewController : UIViewController
{
    IBOutlet MyCustomButton *myButton;
}
@property (nonatomic,retain) MyCustomButton *myButton;
@end

Now in interface Builder, add a UIBUtton and you can connect it to your custom myButton.


I think you mean Interface Builder instead of UIBuilder and something close to what you are looking for is here

http://cocoawithlove.com/2009/07/custom-views-in-interface-builder-using.html

but it doesn't work on iOS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜