Uncovering input fields from iOS Keyboard
Filipe Ximenes • 10 June 2015
One thing new iOS developers notice on their first experiences developing applications is that their interfaces do not adapt to the screen when the keyboard is shown. Because of this, text input fields are hidden by the keyboard if they are to low on the screen. This is a bit annoying and if you have some Android experience you will notice you don't have to deal with this, the OS automatically resizes the interface. The good news is that the solution for this problem is not very complicated.
Please don’t try to develop your own custom solution for this, there are plenty of open source solutions available so you don’t need to waste time on this. I also expect you to use CocoaPods to install third party libraries. If you don’t know what CocoaPods is or is not already using it, I strongly recommend you to go to https://cocoapods.org/ and spend some time exploring it.
With a quick search you can find many libs addressing this issue. I’ve played with some of then and each one work in it’s own way. Some require you to add
imports to your code, others add
UIScrollViews to your interface files and some require extra code to be added to the application.
So far, the best solution I’ve found (both in terms of simplicity and user experience) is IQKeyboardManager. This lib does not require any extra configuration, you add it to your project and it’s already working. So add it to your
and that’s all, your input fields will not be covered by the keyboard anymore.