KeyboardMaster 1.3.0

KeyboardMaster 1.3.0

Maintained by Lucas Best.



KeyboardMaster

Version License Platform

KeyboardMaster is a simple Swift extension on UIScrollView that allows you to easily and automatically manage the keyboard in iOS. Simply call UIScrollView.registerForKeyboardEvents() and the extension will do the rest of the work for you.

The extension converts the frame of the keyboard into the coordinate space of the scroll view, then calculates the overlap. Using the overlap rect the extension then sets self.contentInset accordingly.

The extension uses NotificationCenter to listen for keyboard events so it is important to call UIScrollView.deregisterFromKeyboardEvents() when you are no longer interested in monitoring keyboard activity.

You can also optionally pass the flag automaticallyAdjustContentOffset:true to the .registerForKeyboardEvents() function to have the keyboard automatically scroll up when the keyboard shows.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

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

pod 'KeyboardMaster'

Author

Lucas Best, [email protected]

License

KeyboardMaster is available under the MIT license. See the LICENSE file for more info.