如何为ui控件在xib和storyboard添加属性
展开全部
IB_DESIGNABLE
@implementation IB_UITextField
- (void)setCornerRadius:(CGFloat)cornerRadius{
_cornerRadius = cornerRadius;
self.layer.cornerRadius = _cornerRadius;
self.layer.masksToBounds = YES;
}
-(CGRect)textRectForBounds:(CGRect)bounds {
return CGRectInset(bounds, _Padding, _Padding);
}
-(CGRect)editingRectForBounds:(CGRect)bounds {
return [self textRectForBounds:bounds];
}
@end
@implementation IB_UITextField
- (void)setCornerRadius:(CGFloat)cornerRadius{
_cornerRadius = cornerRadius;
self.layer.cornerRadius = _cornerRadius;
self.layer.masksToBounds = YES;
}
-(CGRect)textRectForBounds:(CGRect)bounds {
return CGRectInset(bounds, _Padding, _Padding);
}
-(CGRect)editingRectForBounds:(CGRect)bounds {
return [self textRectForBounds:bounds];
}
@end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询