我似乎无法辞去文本字段的第一响应者。请帮忙,我已经在stackoverflow上查看了其他解决方案但无法找到解决方案。以下是错误抛出 无法识别的选择器发送到实例
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet var textInputScreen: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
textInputScreen.delegate = self
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
// textField.canResignFirstResponder is true
textField.resignFirstResponder() // throws error
// view.endEditing(true) // throws same error
// textInputScreen.resignFirstResponder() // throws same error
return true
}