学到的2个新的词 IBDesignable IBInspectable

1.IBDesignable是将代码中得视图在xib或者storyboard中显示, 界面可视

swift中写在class 前面 @IBDesignable 注意:不是写在controller的前面,而是写在需要显示的视图的class的前面

OC中 IB_DESIGNABLE 写在@implementation前面

 

2.IBInspectable 属性可视

swift中写在需要显示的属性前面 @IBInspectable let height : CGFloat = 10.0f

OC中 IBInspectable @property (nonatomic, assign) height; //额 这个是错的

应该这么写 

IBInspectable CGFloat x; 哈哈

posted on 2015-09-16 10:19  飞羽的幸福  阅读(101)  评论(0编辑  收藏  举报

导航