Code Monkey home page Code Monkey logo

moveviewupforkeyboardkit's Introduction

MoveViewUpForKeyboardKit Version Build Status

๐Ÿ”ฅ The eternal battle between iOS developers and the keyboard rages on, and the keyboard seems poised for victory. ๐Ÿ”ฅ

Just Google 'iOS move view for keyboard' and gaze upon the desolation. The top answers don't call convertRect, and the keyboard easily destroys them all unless their view's bottom happens to be directly at the bottom of the screen. Apple's documentation doesn't even mention convertRect, and so it too is overrun by the dread keyboard. Many solutions fail miserably under AutoLayout, and are thusly rendered useless. ๐Ÿ’€๐Ÿ’€๐Ÿ’€

๐ŸŒŸโœจBut hark! A bright light appears suddenly upon the horizon, and MoveViewUpForKeyboardKit rides fiercely upon a white stallion to join the fray! :sparkles::star2:

โš” MoveViewUpForKeyboardKit brutally provides a view that will automatically position itself at the bottom of its superview or the top of the keyboard, whichever is higher. With this ultimate weapon against it, the keyboard knows that it cannot prevail. โš”

๐Ÿ—ก In desperation, the keyboard animates itself with undocumented animation curves, but MoveViewUpForKeyboardKit parries by matching them perfectly! The keyboard falls to its knees, and MoveViewUpForKeyboardKit prepares its coup de grรขce. ๐Ÿ—ก

MoveViewUpForKeyboardKitmercilessly handles the case where the keyboard is already visible, and keys fly everywhere as the dread keyboard explodes in a ball of furious hellfire! ๐Ÿ”ฅ๐Ÿ’ฅ๐Ÿ”ฅ๐Ÿ’ฅ๐Ÿ”ฅ

Installation

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

pod MoveViewUpForKeyboardKit

Usage

MoveViewUpForKeyboardKit provides a single class, MVUFKView. All you need to do is put a view of this class in the view hierarchy and set the 'enabled' property. MVUFKViews will automatically do everything required to keep themselves above the keyboard with correct animation. If the keyboard is not visible, or if it doesn't overlap your view, then the MVUFKView will position itself (using constraints) at the bottom of its superview. Once you have a MVUFKView, you can simply use layout constraints to adapt your layout for the keyboard.

moveviewupforkeyboardkit's People

Contributors

griffinschneider avatar jaredegan avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jaredegan

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.