| 
 // 清除按钮左移一个单元 - (CGRect)clearButtonRectForBounds:(CGRect)bounds {     CGRect rect = [super clearButtonRectForBounds:bounds];     if (_isReservedRightView){         rect = CGRectOffset(rect, -rect.size.width, 0);     }     return rect; } 
 // 控制 placeHolder 的位置,左右缩 10 - (CGRect)textRectForBounds:(CGRect)bounds {     CGRect rect = [super textRectForBounds:bounds];     return CGRectInset(rect, 8, 0); } 
 // 控制文本的位置,左右缩 10 - (CGRect)editingRectForBounds:(CGRect)bounds {     CGRect rect = [super textRectForBounds:bounds];     return CGRectInset(rect, 8, 0); } 
 // 重写方法,固定viewMode为Always - (void)setLeftView:(UIView *)leftView {     [super setLeftView:leftView];     self.leftViewMode = UITextFieldViewModeAlways; } 
 注意:clearButton即rightView,如果设置了rightView,clearButton就不会再出现! 
 |