Giter VIP home page Giter VIP logo

adkeyboardmanager's Introduction

CI CocoaPods Language Platform License Twitter

ADKeyboard manager is roughly one helper class to automatically handle the appearance and disappearance of the keyboard with a ScrollView.

Usage

When the keyboard appears you almost always want the same behavior : that the selected UI element is kept visible in order for your user to see what he is typing. That is exactly what ADKeyboardManager does, it automatically add insets to the containing scroll view and scrolls it in order to keep the view visible. On the keyboard disappearance your ScrollView returns to its previous inset values.

To initialize a KeyboardManager you just need to pass it the scrollView you want to adjust when the keyboard appears/disappears.

Since KeyboardManager relies on the notification center to know when the keyboard is showing or hiding you also need it to start observing these notifications, and at some point stop observing. In most case you want to do that during the appearance and disappearance of your viewController :

class MyViewController: UIViewController {
    private lazy var keyboardManager = KeyboardManager(scrollView: myScrollView)

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        keyboardManager.startObservingKeyboard()
    }

    override func viewWillDisappear(_ animated: Bool) {
        keyboardManager.stopObservingKeyboard()
        super.viewWillDisappear(animated)
    }
}

If you need to perform additional changes when the scrolling animations are complete you can also conform to KeyboardManagerDelegate to be notified within the animation block execution.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate ADKeyboardManager into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'ADKeyboardManager', '~> 6.0'
end

Then, run the following command:

$ pod install

Credits

ADKeyboardManager is owned and maintained by Fabernovel Technologies. You can follow us on Twitter at @FabernovelApp.

License

ADKeyboardManager is released under the MIT license. See LICENSE for details.

adkeyboardmanager's People

Contributors

alexandre-pod avatar denispoifol avatar felginep avatar peyronc avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hberenger

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.