STLimitTextField
A textfield that can limit the length of the text.
STLimitTextField is a textfield that can limit the length of the text. You can limit the length of the text or the length of the character.
Requirements
- iOS 8.0 or later (For iOS 8.0 before, maybe it can work, but I have not tested.)
- ARC
Installation
STLimitTextField is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'STLimitTextField'
Usage
Import headers in your source files
In the source files where you need to use the library, import the header file:
#import <STLimitTextField/STLimitTextField.h>
Initialize STLimitTextField
STLimitTextField is a subclass of UITextFiled. You can initialize it like UITextField, of course you can also use storyboard:
STLimitTextField *textFiled = [[STLimitTextField alloc] init];
Configure STLimitTextFiled
STLimitTextFiled has two ways to limit the length of the text. You can use STLimitLength
to limit the length of the text, or use STLimitChar
to limit the length of the text characters:
textFiled.limitType = STLimitLength;
STLimitTextFiled can set the limit length with code or storyboard:
textFiled.limit = 5;
Author
Suta, [email protected]