To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 9.0 or Newer
AnimatedTextFieldCounter is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AnimatedTextFieldCounter'
let textField = AnimatedTextFieldCounter(frame: CGRect(x: 40, y: 80, width: 320, height: 30), maxLength: 5, heightOfCounterView: 4, animationDuration: 0.2, shakeCount: 1)
self.view.addSubview(textField)
- Drag and drop a UITextField from Object Library.
- Go to identity inspector and set class to AnimatedTextFieldCounter.
- And go back to Attributes Inspector. Here we go!
Import The AnimatedTextFieldCounter Class
import AnimatedTextFieldCounter
Add the delegate to your class
class ViewController: UIViewController, AnimatedTextFieldCounterDelegate
Then set the delegate
textField.counterDelegate = self
And use the reachedMaxLimit Method.
func reachedMaxLimit(textfield: AnimatedTextFieldCounter) {
print("hey!")
}
Azat Goktas, [email protected]
AnimatedTextFieldCounter is available under the MIT license. See the LICENSE file for more info.