我们都知道怎么用代码给layer设置圆角,描边,阴影等属性
layer.borderWidth
layer.cornerRadius
layer.borderUIColor
layer.masksToBounds
在xib 或者 storyboard中同样可以设置
只需在空间属性菜单下的”user defined runtime attributes”中添加以上字符串 并选择对应的Type和Value就可以了,
注意!这里有个坑,设置layer.borderUIColor的时候怎么说设置都是黑的 这里给CALayer添加一个分类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
CALayer+XibConfiguration.h import <QuartzCore/QuartzCore.h> import <UIKit/UIKit.h> @interface CALayer(XibConfiguration) @property(nonatomic, assign) UIColor* borderUIColor; @end CALayer+XibConfiguration.m import "CALayer+XibConfiguration.h" @implementation CALayer(XibConfiguration) -(void)setBorderUIColor:(UIColor*)color { self.borderColor = color.CGColor; } -(UIColor*)borderUIColor { return [UIColor colorWithCGColor:self.borderColor]; } @end
|
近期评论