簡體   English   中英

Swift:UITextInput 協議不符合

[英]Swift: UITextInput protocol does not conform

所以我有一個登錄屏幕,它可以工作,但是我的調試器在輸入過程中一遍又一遍地拋出相同的錯誤,我不知道為什么會這樣。

[Assert] View <(null):0x0> does not conform to UITextInput protocol

這是我的代碼

let emailTextField: UITextField = {
    let textField = UITextField()
    textField.placeholder = "emailaddress".localized
    textField.translatesAutoresizingMaskIntoConstraints = false
    textField.backgroundColor = .white
    textField.font = UIFont.init(name: "AlegreyaSans-Regular", size: 18)
    textField.autocapitalizationType = .none
    textField.textContentType = .emailAddress
    textField.keyboardType = .emailAddress
    let paddingView: UIView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 20))
    textField.leftView = paddingView
    textField.leftViewMode = .always
    return textField
}()

它呈現正常,並且工作正常,但是在鍵入時錯誤正在堆積。

不確定這是否對您有幫助,但是當我試圖在用戶點擊返回時隱藏我的鍵盤時遇到了一個類似的問題。 我所做的是將 textField 的委托發送給 textField.delegate = self

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM