Keyboard not dismissed

I am developing a messaging application that have SMS.app-like UI. Conversation screen has text input field at the bottom which is moved up with keyboard. Tapping on conversation area dismisses keyboard by calling resignFirstResponder method on UITextView that we use.

This usually works fine, but users report a weird bug which I can't reproduce and fix. People say that sometimes onscreen keyboard doesn't go away when they tap on conversation area, though text input field loses input focus. Once the view enters that abnormal state users are able to type with keyboard, but text that is being entered is not visible anywhere. This bug happens in one of conversation views and since then no one text input field in other views doesn't work as expected. The only way to stop this weird behavior is killing application from multitasking bar.

Even more weird thing is that keyboard stays visible while navigating between view controllers in UINavigationController. I noticed two things:

  • if tap on '<Back' from conversation view controller with active text field and visible keyboard, keyboard goes away on view change.
  • if tap on '<Back' from conversation view controller with inactive text field and visible keyboard, keyboard doesn't go away on view change.
  • Anyone else experiencing same problems. Any ideas on what may cause this bug?


    If the text field has a delegate, and the delegate is returning NO for textFieldShouldEndEditing , then resignFirstResponder will fail. I don't know if that's the issue you are seeing, but something to check.


    将textfield / textview委托设置为fileowner。

    链接地址: http://www.djcxy.com/p/44288.html

    上一篇: 当弹出窗口出现时如何解除已打开的键盘ios

    下一篇: 键盘没有被解雇