给UIView增加类别
.h
@property(nonatomic,assign) IBInspectable CGFloat cornerRadius;
.m
- (void)setCornerRadius:(CGFloat)cornerRadius
{ self.layer.cornerRadius= cornerRadius;
self.layer.masksToBounds= cornerRadius >0;
}
- (CGFloat)cornerRadius
{ return self.layer.cornerRadius; }
就可以在xib中看到了