Giter Club home page Giter Club logo

Comments (3)

danielamitay avatar danielamitay commented on June 28, 2024

The code in the panning block:

[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
        CGRect toolBarFrame = toolBar.frame;
        toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height;
        toolBar.frame = toolBarFrame;

        CGRect tableViewFrame = tableView.frame;
        tableViewFrame.size.height = toolBarFrame.origin.y;
        tableView.frame = tableViewFrame;
    }];

Is made to place the toolBar just above the keyboard (see toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height;). So naturally when the keyboard goes below the tabBar, the toolBar will do the same.

When you have a situation where the resizing doesn't follow the keyboard pixel by pixel, you need to take that into account when figuring out the new toolBar/tableView/etc frame.

Change the following line:
toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height;
to
toolBarFrame.origin.y = MIN(keyboardFrameInView.origin.y, self.view.bounds.size.height) - toolBarFrame.size.height;

DAKeyboardControl will give you the keyboard's frame, but handling view resizing/repositioning has to be handled on a case-by-case basis.

from dakeyboardcontrol.

jpm avatar jpm commented on June 28, 2024

Gotcha, thanks for the quick explanation here.

I'll buy you a beer at WWDC if we both get tickets. :)

--Joao

from dakeyboardcontrol.

aciidb0mb3r avatar aciidb0mb3r commented on June 28, 2024

If anyone ends up here for same issue with tab bar
This worked for me :

__weak UIViewController *wself = self;

    [self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
        /*
         Try not to call "self" inside this block (retain cycle).
         But if you do, make sure to remove DAKeyboardControl
         when you are done with the view controller by calling:
         [self.view removeKeyboardControl];
         */

        CGRect toolBarFrame = toolBar.frame;
        toolBarFrame.origin.y = MIN(keyboardFrameInView.origin.y,wself.tabBarController.tabBar.frame.origin.y) - toolBarFrame.size.height;

        toolBar.frame = toolBarFrame;

        CGRect tableViewFrame = tableView.frame;
        tableViewFrame.size.height = toolBarFrame.origin.y;
        tableView.frame = tableViewFrame;
    }];

Also, great library :D 👍

from dakeyboardcontrol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.