【ios】点击显示输入框密码
原创
©著作权归作者所有:来自51CTO博客作者james_karon的原创作品,请联系作者获取转载授权,否则将追究法律责任
- (void)viewDidLoad {
[super viewDidLoad];
_showPwd.tag = 100; //按钮的初始状态标记
}
- (IBAction)showPwdClicked:(UIButton *)sender {
switch (_showPwd.tag) {
//To show password
case 100:
_password.secureTextEntry = NO;
_showPwd.tag = 200; //点击后改变状态标记
break;
case 200:
_password.secureTextEntry = YES;
_showPwd.tag = 100;
break;
}
}