• Stars
    star
    415
  • Rank 104,301 (Top 3 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 11 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A text field with a validity indicator

BZGFormField

BZGFormField is a text field with a validity indicator. UI/UX inspired by @muffs

alt tag

The left indicator changes color based on the validity of the field's text - just pass the field a text validation block:

[self.passwordField setTextValidationBlock:^BOOL(BZGFormField *field, NSString *text) {
    return (text.length >= 8);
}];

alt tag

When the text field returns, the indicator expands and becomes tappable.

alt tag

When the indicator is tapped, an alert view is displayed - you can configure the alert view in the text validation block.

[self.passwordField setTextValidationBlock:^BOOL(BZGFormField *field, NSString *text) {
    if (text.length < 8) {
        field.alertView.title = @"Password is too short";
        return NO;
    } else {
        return YES;
    }
}];

alt tag

Installation

If you're using cocoapods, add pod 'BZGFormField' to your Podfile. Otherwise, add BZGFormField/BZGFormField.h and BZGFormField/BZGFormField.m to your project.

Usage

Check out the sample Xcode project in Example