Can I make my UIView @property inspectable?
@interface Superview : UIView
@property (nonatomic, weak, readonly) IBInspectable UIButton *stopButton;
@property (nonatomic, weak, readonly) IBInspectable PKCircleProgressView *circleProgressView;
@end
I've created a designable view PKCircleProgressView, and I want it to be editable from the IB. Also I've created another designable view which contains PKCircleProgressView as subview, and I want it to be editable too.
Is there any way to edit circleProgressView's properties if I use Superview in the IB?
I've come out only with one idea, to create a common protocol for both views, and implement methods such as:
- (void)setProgress:(CGFloat)progress {
self.circleProgressView.progress = progress;
}
but it is not easy to do it with every property, especially if I want to create another View that contains my Superview.
IBInspectable does not support UIView or it's subtypes. It supports simple values.
If your custom progress view is IBDesignable why not set it's properties like radius and foreground color to be IBInspectable and in interface builder select the progress view and change the progress view's properties?
If your creating an IBDesignable superview you might be able to expose the inspectable properties of it's button and progress view using something like the Decorator pattern.