实现这样的圆角效果
问题: leftview和rightView因为切圆角的原因 显示不全。光标也会显示不全。
解决办法 自定义UITextField 继承UITextField
光标显示不全添加leftView
UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15 , 30 )];
self.leftView = view1;
self.leftViewMode = UITextFieldViewModeAlways;
leftview和rightview 向左边或者右边偏移
-(CGRect)rightViewRectForBounds:(CGRect)bounds{
CGRect iconRect = [super rightViewRectForBounds:bounds];
iconRect.origin.x -= 15;
return iconRect;
}
- (CGRect)leftViewRectForBounds:(CGRect)bounds{
CGRect iconRect = [super leftViewRectForBounds:bounds];
iconRect.origin.x += 15;
return iconRect;
}