Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 4 days 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 (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T12:40:24.000Z (over 2 years ago)
- Last Synced: 2025-02-02T03:49:51.914Z (11 days ago)
- Topics: hacktoberfest, ios, keyboard, keyboard-notifications, objective-c
- Language: Objective-C
- Homepage:
- Size: 427 KB
- Stars: 104
- Watchers: 7
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UIViewController-KeyboardAdditions
[![Version](https://img.shields.io/cocoapods/v/UIViewController-KeyboardAdditions.svg?style=flat)](http://cocoadocs.org/docsets/UIViewController-KeyboardAdditions)
[![License](https://img.shields.io/cocoapods/l/UIViewController-KeyboardAdditions.svg?style=flat)](http://cocoadocs.org/docsets/UIViewController-KeyboardAdditions)
[![Platform](https://img.shields.io/cocoapods/p/UIViewController-KeyboardAdditions.svg?style=flat)](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.