//设置左视图 不用设置frame
UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"phoneIcon@x"]];
self.infoText.leftView = imageV;
self.infoText.leftViewMode = UITextFieldViewModeAlways;
//如果是button带点击事件 不设置frame 视图不能上显示
self.secureBtn = [UIButton buttonWithType:UIButtonTypeSystem];
self.secureBtn.frame = CGRectMake(0, 0, self.pwdText.width / 8, self.pwdText.height);
[self.secureBtn setBackgroundImage:[UIImage imageNamed:@"btn_password_hidden@3x"] forState:UIControlStateNormal];
[self.secureBtn addTarget:self action:@selector(hiden) forControlEvents:UIControlEventTouchUpInside];
self.pwdText.rightView = self.secureBtn;
self.pwdText.rightViewMode = UITextFieldViewModeAlways;
//设置占位符 颜色默认
self.pwdText.Placeholder = @"请输入密码";
//设置占位符的颜色
self.pwdText.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入密码" attributes:
//设置是否是一次性清除按钮
self.infoText.clearButtonMode = YES;//设置
//设置是否隐藏密码
self.pwdText.secureTextEntry = YES ;//隐藏