4

I'm using IQKeyboardManager to make keyboard management simple for a notes view controller I have (contains a large UITextView). Once the keyboard is active, however, the screen is shifted up unnecessarily. I'd like for the screen to stay how it is before the keyboard is active (see image below), and only have the UITextView scroll once the user's typing would be covered by the keyboard.

Before keyboard is active

When the keyboard is active (view scrolled up, covering "Notes" and Navigation Bar)

I don't want the Navigation Bar or the "Notes" label to be covered up, but I couldn't find a setting in IQKeyboardManager to stop the UITextView from being pushed all the way to the top.

How can I prevent the view from shifting up so far when the keyboard is made active?

EDIT: I should note that I'm not opposed to removing IQKeyboardManager, I just thought it would make dealing with this either. I mainly just need a way for my UITextView to automatically scroll when the user types something that would go underneath the keyboard.

UPDATE: I solved my problem without IQKeyboardManager by adjusting the contentInset of my UITextView depending on whether or not the keyboard is visible.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
Michael Pangburn
  • 261
  • 1
  • 10

2 Answers2

1

Is you navigation bar translucent? It's common bug in IQKeyboardManager. Try to uncheck "Translucent" property in navigation bar. It's not perfect solution but should works.

0

If you want the screen to stay how it was you can disable the movement behavior for your class with IQKeyboardManager.sharedManager().disabledDistanceHandlingClasses property for example:

/* Probably in your AppDelegate where you setup the keyboard */

IQKeyboardManager.sharedManager().enable = true
IQKeyboardManager.sharedManager().disabledDistanceHandlingClasses = [YourViewController.self]
Oleh Zayats
  • 2,423
  • 1
  • 16
  • 26
  • This keeps the screen how is (thanks!), but it also stops the UITextView from automatically scrolling once the user's text would go below the keyboard. Any suggestions for maintaining that functionality? – Michael Pangburn Apr 02 '17 at 19:09
  • @MichaelPangburn can you share your project? – Oleh Zayats Apr 02 '17 at 19:19