• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tiny UIViewController category that provides handy way for keyboard handling logic.

UIViewController-KeyboardAdditions

Version License Platform

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

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

pod "UIViewController-KeyboardAdditions"

Author

Andrew Podkovyrin, [email protected]

License

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