1、设置padding
[textField setValue:@(5) forKey:@"paddingTop"];
[textField setValue:@(5) forKey:@"paddingLeft"];
[textField setValue:@(5) forKey:@"paddingBottom"];
[textField setValue:@(5) forKey:@"paddingRight"];
2、设置leftView
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, CGRectGetHeight(textField.frame))];
textField.leftView = view;
textField.leftViewMode = UITextFieldViewModeAlways;
网友评论