Primary Action触发后的键盘KeyboardWillShowNotification

时间:2020-03-06 03:49:16

标签: ios swift uitextfield

我做了一些研究,但仍然找不到任何答案。场景很简单:

我有一个名为MainVC的ViewController
我在viewDidLoad中放了2个观察者

NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
  • 我有一个UITextField,链接了触发到MainVC的主操作,称为doneAction

  • 每次我按下“返回”键时,它都会发布keyboardWillShowNotification,尽管doneAction中没有一行代码

这是UITextField的某种错误或怪异反应吗?还是官方行为?

感谢您的帮助。

0 个答案:

没有答案