Skip to content
UITextField with elastic bounce effect on touch.
Swift Ruby Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
WWElasticTextField.xcodeproj
WWElasticTextField
WWElasticTextFieldTests
.DS_Store
LICENSE
README.md
WWElasticTextField.podspec
customize.gif
elastic.gif
setup.gif

README.md

WWElasticTextField

UITextField with elastic bounce effect on touch.

Requirements

  • Xcode 7+
  • iOS 8.0+
  • ARC
  • Swift 2.0+

Installation

CocoaPods

use_frameworks!
pod "WWElasticTextField"

Usage

Simply replace UITextField with WWElasticTextField in source code or interface builder.

In source code

import WWElasticTextField

override func viewDidLoad() {
  super.viewDidLoad()

  /* ... */

  /* initialize */
  let elasticTextField = WWElasticTextField(frame: CGRectMake(0, 0, 97, 30))
        
  /* set position */
  elasticTextField.center = view.center
        
  /* customize */
  elasticTextField.overshootAmount = 30
        
  /* add to super view */
  view.addSubview(elasticTextField)

  /* ... */
}

In interface builder

Set up

Drag a new UITextView from object library and set its custom class to be WWElasticTextField.

Customize

Play with the value of overshootAmount (positive or negative) and see how the elastic extent changes accordingly.

Tutorial

https://www.raywenderlich.com/100939/how-to-create-an-elastic-animation-with-swift

License

Released under the MIT license. See LICENSE for details.

You can’t perform that action at this time.