Latest 0.0.1
Homepage https://github.com/merend/EDKeyboardHandler
License MIT
Platforms ios 8.0
Authors

[![CI Status](http://img.shields.io/travis/Eren Demirbuken/EDKeyboardHandler.svg?style=flat)](https://travis-ci.org/Eren Demirbuken/EDKeyboardHandler)
Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

just init and listen to keyboard with block

  self.keyboardHandler = [EDKeyboardHandler new];

  [self.keyboardHandler listenWithBlock:^(KeyboardInfo *model)
  {
    //adjust view positions according to keyboard position here
  }];

KeyboardHandler also provides KeyboardHandlerDelegate to listen keyboard position with delegation

@protocol KeyboardHandlerDelegate <NSObject>
@optional
- (void)currentKeyboardInfo:(KeyboardInfo *) keyboardInfo;
@end

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

TL;DR sample usage:

    self.keyboardHandler = [EDKeyboardHandler new];

    [self.keyboardHandler listenWithBlock:^(KeyboardInfo *keyboardInfo)
    {
      if (keyboardInfo.status == KeyboardStatusWillShow || keyboardInfo.status == KeyboardStatusDidShow)
       {
          CGRect inputViewFrame = self.inputView.frame;
          inputViewFrame.origin.y = keyboardInfo.keyboardFrame.origin.y - inputViewFrame.size.height ;
          self.inputView.frame = inputViewFrame;

      }else{
          //handle keyboard hiding here
      }
    }];

Screen shot

alt tag

Requirements

Installation

EDKeyboardHandler is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "EDKeyboardHandler"

Author

Eren Demirbuken, [email protected]

License

EDKeyboardHandler is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "EDKeyboardHandler",
    "version": "0.0.1",
    "summary": "simple keyboard listener",
    "description": "lightweight keyboard listener to adjust views according to keyboard position.",
    "homepage": "https://github.com/merend/EDKeyboardHandler",
    "license": "MIT",
    "authors": {
        "Eren Demirbuken": "[email protected]"
    },
    "source": {
        "git": "https://github.com/merend/EDKeyboardHandler.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "EDKeyboardHandler/Classes/**/*",
    "resource_bundles": {
        "EDKeyboardHandler": [
            "EDKeyboardHandler/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This