UIViewController-KeyboardAdditions 1.2.1

UIViewController-KeyboardAdditions 1.2.1

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

Maintained by Andrew Podkovyrin.



Swift Version

For Swift compatible version check out Keyboardy

Description

UIViewController+KeyboardAdditions category simplifies keyboard handling logic by extending UIViewController class with several simple methods. Supports both AutoLayout and frame-based animations.

UIViewController-KeyboardAdditions Demo GIF

Usage

  1. Import category #import <UIViewController-KeyboardAdditions/UIViewController+KeyboardAdditions.h>

  2. Register to keyboard notifications in -viewWillAppear::

[self ka_startObservingKeyboardNotifications];
  1. Unregister from notifications in -viewWillDisappear::
[self ka_stopObservingKeyboardNotifications];
  1. Perform any layout with same animation options as keybord:
- (void)ka_keyboardShowOrHideAnimationWithHeight:(CGFloat)height
                               animationDuration:(NSTimeInterval)animationDuration
                                  animationCurve:(UIViewAnimationCurve)animationCurve {

    self.containerViewBottomConstraint.constant = height;
    [self.view layoutIfNeeded];
}

Example

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

Installation

Author

Andrew Podkovyrin, [email protected]

License

UIViewController-KeyboardAdditions is available under the MIT license. See the LICENSE file for more info.