Giter Club home page Giter Club logo

singlelinekeyboardresize's Introduction

SingleLineKeyboardResize

With this non-intrusive UIViewController extension, only a single line of code will make your scrollView auto resize when the keyboard appears. It literally cannot get easier than this, and you don't even need to subclass anything.

CI Status Version License Platform

Demo

UIScrollView

Resize Example

UITableView

Resize Example

USAGE

For a scrollView from nib or storyboard

@IBOutlet weak var scrollView : UIScrollView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupKeyboardNotifcationListenerForScrollView(scrollView)
    }

Just as simple if you want to use it with a tableView

@IBOutlet weak var tableView : UITableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupKeyboardNotifcationListenerForScrollView(tableView)
        
    }

To remove observers for example in deinit

deinit {
        removeKeyboardNotificationListeners()
    }

Installation

CocoaPods

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

pod "SingleLineKeyboardResize"

Without CocoaPods:

It's only one file you need, 'UIViewController+Keyboard.swift', copy it into your project, and you are good to go.

Author

Håkon Bogen, [email protected]

License

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

Single Line APIs

Really good APIs should not need more than a single line of code to work and be as non intrusive as possible. This library is a part of my ongoing effort to build single line libraries for iOS. Check out the other ones on the list as well.

singlelinekeyboardresize's People

Contributors

haaakon avatar kaphacius avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

singlelinekeyboardresize's Issues

How to use with small scroll view

This seems to only work if your scroll view content is longer than the screen. I have a view with a single scroll view, but the content fits on the entire screen until the keyboard appears. So I only need to scroll when the keyboard is up. In this case the code shifts the display up, but scrolling is disabled.

Any idea how to get around this?

Not working with a search controller

Not working with a search controller

leaves extra space at the bottom probably because of the search textfield being in the nav bar and it not calculating the size properly

ios 7 support

Is there any particular reason for setting the minimum iOS platform to 8?

Some error calculating keyboard size for bigger phones (as example iPhone 6)

It works very well for iPhone 5 on which I mainly played with it.
However, it has problems with resizing on iPhone 6.

As example, I have a view with just one TextView which occupies whole screen. The keyboard is opened when TextView becomes a first responder. SingleLineKeyboardResize is executed and it inserts to TextView. However, inserts are a little bit wrong size. As result, the bottom of TextView will end up being under the keyboard.

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.