Derrick.Fang
Derrick.Fang

Reputation: 1

iOS 11.0 UITextField secureTextEntry doesn't work?

I found that secureTextEntry doesn't work on iOS 11.0, my code is simple like this:

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

What can I do to solve this problem?

Upvotes: 0

Views: 1162

Answers (3)

Amal T S
Amal T S

Reputation: 3405

Do you call [tfPwd1 becomeFirstResponder] anywhere? Add tfPwd1.secureTextEntry = YES; before calling [tfPwd1 becomeFirstResponder]. Don't add it while UIKeyboard is present

Upvotes: 0

Moin Shirazi
Moin Shirazi

Reputation: 4425

I just check on my system its working with this code

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

Upvotes: 0

Vignesh Davins
Vignesh Davins

Reputation: 285

change .secureTextEntry to .isSecureTextEntry

hope it works.

Upvotes: 1

Related Questions