UITextField 光标离左侧距离
2017-02-22 本文已影响284人
Mr_Dragonn
- (UITextField *)passwordTextField {
if (nil == _passwordTextField) {
_passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(kText_Button_Margin, CGRectGetMaxY(self.userNameTextField.frame)+kText_Button_Height/2, kText_Button_Width, kText_Button_Height)];
CGRect frame = _passwordTextField.frame;
//设置距离
frame.size.width = 8;
UIView *leftview = [[UIView alloc] initWithFrame:frame];
_passwordTextField.leftViewMode = UITextFieldViewModeAlways;
_passwordTextField.leftView = leftview;
_passwordTextField.placeholder = NSLocalizedString(@"Password", @"");
_passwordTextField.layer.borderWidth = kBorder_Width;
_passwordTextField.layer.borderColor = [UIColor lightGrayColor].CGColor;
_passwordTextField.layer.cornerRadius = kCornerRadius;
_passwordTextField.layer.masksToBounds = YES;
_passwordTextField.delegate = self;
_passwordTextField.font = [UIFont systemFontOfSize:PxtoPoint_Width(49)];
_passwordTextField.clearButtonMode = UITextFieldViewModeAlways;
_passwordTextField.secureTextEntry = YES;
}
return _passwordTextField;
}