使用IB_DESIGNABLE与IBInspectable特性实现可在视图编辑器的功能栏中设置

当我们在自定义一个控件的时候,为了在视图编辑器中方便进行设置自定义了的新属性

可以用以下方式实现,只要在相应地方加上:IB_DESIGNABLE 和 IBInspectable

IB_DESIGNABLE
@interface ZTransitionSubmitButton : UIButton <UIViewControllerTransitioningDelegate>

@property (nonatomic, retain) IBInspectable  UIColor *highlightedBackgroundColor;
@property (nonatomic, retain) IBInspectable  UIColor *normalBackgroundColor;

@end
Blog都是随笔,只当做笔记,不会有详细介绍,测试请慎重。。。
原文地址:https://www.cnblogs.com/JerryBaxia/p/4790827.html