Latest 1.1.3
Homepage https://github.com/LR-Studio/LRTextField
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, CoreGraphics, UIKit
Authors

A subclass of UITextField that supports float label, validation, inputmask, and IB_DESIGNABLE (Xcode 6). The expectation is that our text field can offer great functionality, while keeping the original design.

How to install

pod 'LRTextField'

USAGE

Init with code

Email

    // init with pre-defined style
    LRTextField *textFieldEmail = [[LRTextField alloc] initWithFrame:CGRectMake(20, 70, 260, 30) labelHeight:15 style:LRTextFieldStyleEmail]; 
    [self.view addSubview:textFieldEmail];

Phone

    LRTextField *textFieldPhone = [[LRTextField alloc] initWithFrame:CGRectMake(20, 150, 260, 30) labelHeight:15];
    textFieldPhone.placeholder = @"Phone";
    textFieldPhone.hintText = @"(Optional)";
    textFieldPhone.format = @"(###)###-####"; // set format for segment input string
    textFieldPhone.keyboardType = UIKeyboardTypePhonePad;
    [self.view addSubview:textFieldPhone];

Validation

    LRTextField *textFieldValidation = [[LRTextField alloc] initWithFrame:CGRectMake(20, 240, 260, 30) labelHeight:15];
    textFieldValidation.placeholder = @"Validation Demo";
    textFieldValidation.hintText = @"Enter "abc"";
    [textFieldValidation setValidationBlock:^NSDictionary *(LRTextField *textField, NSString *text) {
        [NSThread sleepForTimeInterval:1.0];
        if () {
            return @{ VALIDATION_INDICATOR_YES : @"Correct" };
        }
        return @{ VALIDATION_INDICATOR_NO : @"Error" };
    }];
    [self.view addSubview:textFieldValidation];

Init in Storyboard / Xib

SB-result

SB-how

CUSTOMIZE

Color

color

    LRTextField *textFieldCustom = [[LRTextField alloc] initWithFrame:CGRectMake(20, 320, 260, 30) labelHeight:15];
    textFieldCustom.placeholder = @"Placeholder";
    textFieldCustom.placeholderActiveColor = [UIColor redColor];
    textFieldCustom.placeholderInactiveColor = [UIColor blackColor];
    textFieldCustom.hintText = @"Purple hint";
    textFieldCustom.hintTextColor = [UIColor purpleColor];
    [self.view addSubview:textFieldCustom];

Disable Animation

noanimation

    textFieldCustom.enableAnimation = NO;

TROUBLESHOOTING

Please send an email [email protected]

Latest podspec

{
    "name": "LRTextField",
    "version": "1.1.3",
    "summary": "UITextField with label, validation and input mask on iOS.",
    "description": "UITextField with label, validation and input mask on iOS, which is implemented by Objective-C.",
    "homepage": "https://github.com/LR-Studio/LRTextField",
    "license": "MIT",
    "authors": {
        "LR Studio": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LR-Studio/LRSmartTextField.git",
        "tag": "1.1.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "LRTextField/*",
    "frameworks": [
        "Foundation",
        "CoreGraphics",
        "UIKit"
    ]
}

Pin It on Pinterest

Share This