使用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

 

posted @ 2015-09-08 10:28  张永存(Jerry)  阅读(141)  评论(0编辑  收藏  举报