Latest 1.5.2
License MIT
Platforms ios 7.0, requires ARC

License MIT 
Build Status 
Apps Using 

My library does not seek any reward,
but if you use this library, star it if you like. :)



  • Automatic processing of keyboard-related events with little code, not affect global and no special view or viewController nee to be inherited, so it’s flexible.
  • Provide a optional default retractButton which can be clicked to hide keyboard.
  • Use animateAlongsideBlock to add your own dodge behaviors for other views or to trigger other behaviors.
  • With transition complete of two vc, the dodge behavior would be triggered again, ensure dodge behavior.
  • Fixed iOS8’s bug: UIKeyboardFrameEndUserInfoKey return strange origin.y sometimes.
  • Fixed SougouInput’s bug: it produces a ungly spring animation sometimes.


  • The dodgeView means which view need to be change frame or change contentOffset(contentInset)
  • All subviews which can becomeFirstResponder in the dodgeView will trigger the dodge behavior.
  • The inputView of subviews maybe not only keyboard. It’s ok, this is why the library named MLInputDodger not MLKeyboardDodger. :)


- (void)viewDidAppear:(BOOL)animated
    [super viewDidAppear:animated];

    self.view.shiftHeightAsDodgeViewForMLInputDodger = 50.0f;
    [self.view registerAsDodgeViewForMLInputDodgerWithOriginalY:self.view.frame.origin.y];

Then the subviews which can becomeFirstResponder will trigger dodge.
If you need custom shiftHeight for special responder, just set the shiftHeightAsFirstResponderForMLInputDodger property.

Disbale default retract input accessory view:

self.view.dontUseDefaultRetractViewAsDodgeViewForMLInputDodger = NO; //for all subviews of self.view

self.testView1.dontUseDefaultRetractViewAsFirstResponderForMLInputDodger = NO; //for sepecial


[[MLInputDodger dodger]setAnimateAlongsideBlock:^(BOOL show,UIView *dodgerView,UIView *firstResponderView,CGRect inputViewFrame) {
        if ([dodgerView isKindOfClass:[UIScrollView class]]) {
            ((UIScrollView*)dodgerView).scrollIndicatorInsets = ((UIScrollView*)dodgerView).contentInset;
__weak __typeof(self)weakSelf = self;
    [self.tableView setAnimateAlongsideAsDodgeViewForMLInputDodgerBlock:^(BOOL show,UIView *dodgerView,UIView *firstResponderView,CGRect inputViewFrame) {
        __strong __typeof(weakSelf)sSelf = weakSelf;
        CGRect frame = sSelf.testAnimateAlongsideLabel.frame;
        if (show) {
            frame.origin.y = inputViewFrame.origin.y+kMLInputDodgerRetractViewDefaultHeight-kLabelBottomMargin-kLabelHeight;
            frame.origin.y = sSelf.view.frame.size.height-kLabelBottomMargin-kLabelHeight;
        sSelf.testAnimateAlongsideLabel.frame = frame;


You can add this category to disable automatic keyboard for UITableViewController, or it will affect the implementation of the library.
But _adjustForAutomaticKeyboardInfo:animated:lastAdjustment: is a private api, so…

@implementation UITableView(DisableAutomaticKeyboard)
- (void)_adjustForAutomaticKeyboardInfo:(id)arg1 animated:(BOOL)arg2 lastAdjustment:(float*)arg3 {

Latest podspec

    "name": "MLInputDodger",
    "version": "1.5.2",
    "summary": "The best view dodger for inputting.",
    "homepage": "",
    "license": {
        "type": "MIT"
    "authors": {
        "molon": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.5.2"
    "platforms": {
        "ios": "7.0"
    "public_header_files": "Classes/**/*.h",
    "source_files": "Classes/**/*.{h,m}",
    "resources": "Classes/**/*.bundle",
    "requires_arc": true

Pin It on Pinterest

Share This