_psd.secureTextEntry = YES; //默认暗文
- (IBAction)pwdTextSwitch:(UIButton *)sender {
sender.selected = !sender.selected;
if (sender.selected) {
// 按下去了就是明文
NSString *tempPwdStr = _psd.text;
_psd.text = @"";
_psd.secureTextEntry = NO;
_psd.text = tempPwdStr;
} else {
// 暗文
NSString *tempPwdStr = _psd.text;
_psd.text = @"";
_psd.secureTextEntry = YES;
_psd.text = tempPwdStr;
}
}