Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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.

UIViewController-KeyboardAdditions Demo GIF

## 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.