UIViewController-KeyboardAdditions
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.
Usage
-
Import category
#import <UIViewController-KeyboardAdditions/UIViewController+KeyboardAdditions.h> -
Register to keyboard notifications in
-viewWillAppear::
[self ka_startObservingKeyboardNotifications];- Unregister from notifications in
-viewWillDisappear::
[self ka_stopObservingKeyboardNotifications];- 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.
