iOS 11.0 UITextField secureTextEntry不起作用?

时间:2017-06-28 10:26:53

标签: ios uitextfield ios11

我发现secureTextEntry在iOS 11.0上不起作用,我的代码很简单:

tfPwd1.keyboardType = UIKeyboardTypeNumberPad;
tfPwd1.secureTextEntry = YES;
tfPwd1.delegate = self;

我该怎么做才能解决这个问题?

3 个答案:

答案 0 :(得分:1)

.secureTextEntry更改为.isSecureTextEntry

希望它有效。

答案 1 :(得分:0)

我只是检查我的系统使用此代码

 override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        txtfld.isSecureTextEntry = true
    }

答案 2 :(得分:0)

你在任何地方打电话给[tfPwd1 becomeFirstResponder]吗?在致电tfPwd1.secureTextEntry = YES;之前添加[tfPwd1 becomeFirstResponder]。在UIKeyboard出现时不要添加