Skip to content

With this non-intrusive UIViewController extension, only a single line of code will make your scrollView auto resize when the keyboard appears

License

Notifications You must be signed in to change notification settings

27crags/SingleLineKeyboardResize

This branch is 2 commits ahead of haaakon/SingleLineKeyboardResize:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Amr MousaAmr Mousa
Amr Mousa
and
Amr Mousa
Sep 21, 2018
c26cb82 · Sep 21, 2018

History

41 Commits
Nov 23, 2017
Oct 4, 2016
Oct 4, 2016
Feb 20, 2015
May 3, 2015
Apr 6, 2016
Sep 21, 2018
Feb 20, 2015
Feb 21, 2015

Repository files navigation

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.

About

With this non-intrusive UIViewController extension, only a single line of code will make your scrollView auto resize when the keyboard appears

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 86.7%
  • Ruby 12.4%
  • C 0.9%