I have a UIView, it is not inside UIScrollView. I would like to move up my View when the keyboard appears. Before I tried to use this solution: How can I make a UITextField
i just created a lightweight keyboard handler to follow keyboard frame.
Usage:
self.keyboardHandler = [EDKeyboardHandler new];
[self.keyboardHandler listenWithBlock:^(KeyboardInfo *model)
{
//adjust view positions according to keyboard position here
}];
and the KeyboardInfo model has the following properties:
typedef enum : NSUInteger {
KeyboardStatusDidShow,
KeyboardStatusWillShow,
KeyboardStatusDidHide,
KeyboardStatusWillHide,
} KeyboardStatus;
@interface KeyboardInfo:NSObject
@property (nonatomic,readonly) NSTimeInterval animationDuration;
@property (nonatomic,readonly) CGRect keyboardFrame;
@property (nonatomic,readonly) NSInteger animationCurve;
@property (nonatomic,readonly) KeyboardStatus status;
@end
check GitHub project for details and cocoaPods integration.