MoveViewUpForKeyboardKit 3.0.1

MoveViewUpForKeyboardKit 3.0.1

TestsTested โœ—
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2017

Maintained by Griffin Schneider, Jared Egan.



  • By
  • Griffin Schneider

๐Ÿ”ฅ The eternal battle between iOS developers and the keyboard rages on, and the
keyboard seems poised for victory. ๐Ÿ”ฅ

Just Google 'iOS move view for keyboard' and gaze upon the desolation. The
top answers don't call convertRect, and the keyboard easily destroys them
all unless their view's bottom happens to be directly at the bottom of the
screen. Apple's documentation doesn't even mention convertRect, and so it
too is overrun by the dread keyboard. Many solutions fail miserably under
AutoLayout, and are thusly rendered useless. ๐Ÿ’€๐Ÿ’€๐Ÿ’€

๐ŸŒŸโœจBut hark! A bright light appears suddenly upon the horizon, and
MoveViewUpForKeyboardKit rides fiercely upon a white stallion to join the fray!
โœจ๐ŸŒŸ

โš” MoveViewUpForKeyboardKit brutally provides a view that will automatically position
itself at the bottom of its superview or the top of the keyboard, whichever is higher.
With this ultimate weapon against it, the keyboard knows that it cannot prevail. โš”

๐Ÿ—ก In desperation, the keyboard animates itself with undocumented animation curves, but
MoveViewUpForKeyboardKit parries by matching them perfectly! The keyboard falls to its knees,
and MoveViewUpForKeyboardKit prepares its coup de grรขce. ๐Ÿ—ก

MoveViewUpForKeyboardKitmercilessly handles the case where the keyboard is
already visible, and keys fly everywhere as the dread keyboard explodes in a ball
of furious hellfire! ๐Ÿ”ฅ๐Ÿ’ฅ๐Ÿ”ฅ๐Ÿ’ฅ๐Ÿ”ฅ

Installation

MoveViewUpForKeyboardKit is available through CocoaPods. To install
it, just add the following line to your Podfile:

pod MoveViewUpForKeyboardKit

Usage

MoveViewUpForKeyboardKit provides a single class, MVUFKView. All you need to do
is put a view of this class in the view hierarchy and set the 'enabled' property.
MVUFKViews will automatically do everything required to keep themselves above
the keyboard with correct animation. If the keyboard is not visible, or if it doesn't
overlap your view, then the MVUFKView will position itself (using constraints) at
the bottom of its superview. Once you have a MVUFKView, you can simply use layout
constraints to adapt your layout for the keyboard.