I\'d like to create @IBInspectable
element as you see at the picture below :
I do this using a Inspectable NSInteger value and override the setter to allow it to set the enum. This has the limitation of not using a popup list and if you change your enum values, then the interface options will not update to match.
Example.
In Header File:
typedef NS_ENUM(NSInteger, LabelStyle)
{
LabelStyleContent = 0, //Default to content label
LabelStyleHeader,
};
...
@property LabelStyle labelStyle;
@property (nonatomic, setter=setLabelAsInt:) IBInspectable NSInteger labelStyleLink;
In the implementation file:
- (void)setLabelAsInt:(NSInteger)value
{
self.labelStyle = (LabelStyle)value;
}
You could optionally add some logic in there to ensure that it is being set to a valid value