How to enable/disable OneTimeCode feature for specific text field?

后端 未结 3 1460
故里飘歌
故里飘歌 2020-12-22 02:58

For OTP text field, I have set textContentType as oneTimeCode

if #available(iOS 12.0, *) {
     otpTextField.textContentType = .oneTimeCode
}    
3条回答
  •  时光说笑
    2020-12-22 03:31

    I tried all sorts of content types to prevent OTP from being suggested on the keyboard, finally this one worked

    if #available(iOS 12.0, *) {
        textField.textContentType = .username
    }
    

    In this case the UITextField is capturing a pin, and also has

    keyboardType = .numberPad
    

    Although that may not make a difference

提交回复
热议问题