For Swift compatible version check out Keyboardy
UIViewController+KeyboardAdditions
category simplifies keyboard handling logic by extending UIViewController class with several simple methods.
Supports both AutoLayout and frame
-based animations.
Import category #import <UIViewController-KeyboardAdditions/UIViewController+KeyboardAdditions.h>
Register to keyboard notifications in -viewWillAppear:
:
[self ka_startObservingKeyboardNotifications];
-viewWillDisappear:
:[self ka_stopObservingKeyboardNotifications];
- (void)ka_keyboardShowOrHideAnimationWithHeight:(CGFloat)height
animationDuration:(NSTimeInterval)animationDuration
animationCurve:(UIViewAnimationCurve)animationCurve {
self.containerViewBottomConstraint.constant = height;
[self.view layoutIfNeeded];
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
UIViewController-KeyboardAdditions is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "UIViewController-KeyboardAdditions"
Andrew Podkovyrin, podkovyrin@gmail.com
UIViewController-KeyboardAdditions is available under the MIT license. See the LICENSE file for more info.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。