Extending UITextField to Have Validation

I’ve created a subclass of UITextField that adds validation facilities and appearance feedback.

Image

The idea is that users are happier when it is clear what is expected from them. If you have fields in a form, say, and some either NEED to be filled out or they NEED to be filled out in a specific way, the validating text field will indicate visually if the field has everything it needs.

Programmatically, it’s easy to set up. You either assign a block to the text field that returns a BOOL or implement the validation delegate protocol. The textfield will take care of its own appearance.

Get the code from here and I hope you find it useful!

https://github.com/jmenter/JAMValidatingTextField

Get a sample Xcode 5 project from here: https://dl.dropboxusercontent.com/u/3903183/TextFields.zip

Screen Shot 2014-03-01 at 1.51.39 PM

Advertisements

One Response to Extending UITextField to Have Validation

  1. dhawaldawar says:

    I have also created class for handling UITextField, please have a look on my blog http://dhawaldawar.wordpress.com/2014/06/11/uitextfield-validation-ios/

    Hope you will like it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: