UITextField with elastic bounce effect on touch.
- Xcode 7+
- iOS 8.0+
- ARC
- Swift 2.0+
use_frameworks!
pod "WWElasticTextField"
Simply replace UITextField with WWElasticTextField in source code or interface builder.
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)
/* ... */
}
Drag a new UITextView from object library and set its custom class to be WWElasticTextField.
Play with the value of overshootAmount (positive or negative) and see how the elastic extent changes accordingly.
https://www.raywenderlich.com/100939/how-to-create-an-elastic-animation-with-swift
Released under the MIT license. See LICENSE for details.