Search code examples
iosuikeyboarddismissscreen-rotation

How to prevent keyboard from dismissing when device rotates?


I have an iPhone app that has a "contact picker" using a table view. If my "recipient" field is active and the keyboard is shown, then the device is rotated, the keyboard dismisses itself automatically.

How can I disable this functionality?


Solution

  • Turns out, my TokenView was reloading on rotation and not re-setting the firstResponder to it's textView, which caused the keyboard to hide.

    Fixed the issue by adding a line to set the first responder to the TokenView's UITextView in it's 'reloadData' function.