An open API service indexing awesome lists of open source software.

https://github.com/onmotion/asviewcontroller

iOS ViewController with auto scroll to active textField when keyboard is showing
https://github.com/onmotion/asviewcontroller

ios keyboard-scroll-adjust scroll swift textfield-scroll

Last synced: about 1 year ago
JSON representation

iOS ViewController with auto scroll to active textField when keyboard is showing

Awesome Lists containing this project

README

          

# ASViewController

[![Version](https://img.shields.io/cocoapods/v/ASViewController.svg?style=flat)](http://cocoapods.org/pods/ASViewController)
[![License](https://img.shields.io/cocoapods/l/ASViewController.svg?style=flat)](http://cocoapods.org/pods/ASViewController)
[![Platform](https://img.shields.io/cocoapods/p/ASViewController.svg?style=flat)](http://cocoapods.org/pods/ASViewController)

## Example

![sample](https://github.com/onmotion/ASViewController/blob/captions/Screenshots/2.gif)

## Requirements

iOS 8.0+
Swift 4.0

## Installation

ASViewController is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'ASViewController'
```
* Add import **ASViewController** to your **ViewController**

* Inherit your **ViewController** from **ASViewController** instead **UIASViewController**

* then wrap your view contains text fields into **UIScrollView**, add ```@IBOutlet``` and bind it to scrollableArea as so:

![sample2](https://github.com/onmotion/ASViewController/blob/captions/Screenshots/1.gif)

* Setup AutoLayout like so:

![1](https://github.com/onmotion/ASViewController/blob/captions/Screenshots/1.png)

![2](https://github.com/onmotion/ASViewController/blob/captions/Screenshots/2.png)

## Settings

Also you can set up offset to text field (default = 20)

```
ASViewController.offset = 10
```
```
ASViewController.dismissKeyboardWhenTapAnywhere = true // (default = false) keyboard will be hidden when tapped anywhere outside textfield
```

## Author

Alexandr Kozhevnikov, onmotion1@gmail.com

## License

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