[英]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.