Ive been looking into IB_designable and it is a really awesome feature. However, one issue that I have with it is that for each view, I have to subclasses a UIView. And within that Subclass I have to specify the UI elements inside the initWithCoder: method and prepareForInterfaceBuilder:
However, I want to be able to specify the UI Elements OUTSIDE of the class.
I want to make a UIView subclass that has a public property of which I can set from the outside and see in Inter face builder.
Is this possible?
UPDATE:
I am aware of IBInspectible. This makes the property available in the Attributes inspector. This is not what I mean by external.
IB_DESIGNABLE
@interface DesignableLabel : UILabel
@end
@implementation DesignableLabel
@end
@interface SomeClass : UIViewController {
IBOutlet DesignableLabel *DL;
}
@end
@interface SomeClass
- (void)prepareForInterfaceBuilder {
DL.text = @"Hello World"
}
@end
DesignableLable is a subclass of UILabel. UILabels have a text property. I want SomeClass to somehow set that property. Normally if I do that and run the app, it should show the string. However, to save myself the trouble of running the app, I want it to show up in Interface builder so I can see its value as I type.