To run the example project, clone the repo, and run pod install
from the Example directory first.
Using it on GRTextField on IB is pretty straightforward, you have use it as the class (at the Identity Inspector Tab on the right panel) for the UITextField element on your storyboard.
If you want to set a label as an output source for your error messages, you can drag the "errorLabel" item on the connections inspector
the field instance will automatically hide the label if you set it as the errorLabel outlet
On the attributes inspector tab, you cant set the properties for the textField
Mask Pattern: Will turn your field into NUMERIC ONLY and will try to match the pattern specified in this property. e.g.: using (##) #####-#### (BR cellphone mask) as a mask will output the text as (01) 23456-7890
Error Message Key: Will either use a localizable* key specified on a string table file, word or phrase, you decide which one you want to use.
Has Border: Toggle the bottom line on the field.
Max Characters: Set a max number of characters for the field, it will work with alphanumeric characters as well, BUT only if your Mask Pattern is empty, otherwise it will prioritize the Mask Pattern property and ignore this one.
*Unfortunately, at this time the field is only accepting strings from a string table named "localizable.strings", I'll try to change that asap.
Border: Defines the color for the bottom line when the field is not selected;
Error: Defines the color for both error label and bottom line when there's an error**;
Selected: Defines the color for the bottom line when the field is selected and there's no errors;
There's no secret mystery behind this one.
GRTextField * textField = [[GRTextField alloc] init];
or
GRTextField * textField = [GRTextField new];
Apart from the properties already specified here (in the upper section), there's also the documentation on CocoaDocs
ARC
GRTextField is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "GRTextField"
GRTextField is available under the MIT license. See the LICENSE file for more info.