https://github.com/podkovyrin/uiviewcontroller-keyboardadditions
Tiny UIViewController category that provides handy way for keyboard handling logic.
https://github.com/podkovyrin/uiviewcontroller-keyboardadditions
hacktoberfest ios keyboard keyboard-notifications objective-c
Last synced: 2 months ago
JSON representation
Tiny UIViewController category that provides handy way for keyboard handling logic.
- Host: GitHub
- URL: https://github.com/podkovyrin/uiviewcontroller-keyboardadditions
- Owner: podkovyrin
- License: mit
- Created: 2015-02-05T22:22:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T12:40:24.000Z (over 2 years ago)
- Last Synced: 2025-04-11T10:43:03.408Z (3 months ago)
- Topics: hacktoberfest, ios, keyboard, keyboard-notifications, objective-c
- Language: Objective-C
- Homepage:
- Size: 427 KB
- Stars: 104
- Watchers: 6
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UIViewController-KeyboardAdditions
[](http://cocoadocs.org/docsets/UIViewController-KeyboardAdditions)
[](http://cocoadocs.org/docsets/UIViewController-KeyboardAdditions)
[](http://cocoadocs.org/docsets/UIViewController-KeyboardAdditions)## Swift Version
For Swift compatible version check out [Keyboardy](https://github.com/podkovyrin/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
1. Import category `#import `
2. Register to keyboard notifications in `-viewWillAppear:`:
```obj-c
[self ka_startObservingKeyboardNotifications];
```3. Unregister from notifications in `-viewWillDisappear:`:
```obj-c
[self ka_stopObservingKeyboardNotifications];
```4. Perform any layout with same animation options as keybord:
```obj-c
- (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](http://cocoapods.org). 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.