Registration, Login, and Validation Complete - Download the Code!
The screen's were created yesterday, today I've finished off the user experience by adding validation and alert windows to both the Registration and Log-in screens. I've also made the code available for download!
- Created a Validation class.
- Created Alert windows when validation fails.
- Change keyboard layout based on "type" of text field.
Some references:
The Validation class has methods that I can call from any other class, for example:
// init the validation class
Validation *validate = [[Validation alloc] init];
// validate email and pop alert if need be
BOOL emailValid = [validate emailRegEx:emailEntry.text];
And popped an Alert View if validation failed:
if (!emailValid) { UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Invalid Email"
message:@"Your email address is not valid. Please try again."
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Okay",
nil];
[alert show];
[alert autorelease];
[emailTextField becomeFirstResponder]; }
The "becomeFirstResponder" at the end attempts to push focus back to the email field after the user clicks "Okay" on the Alert View. You can see all of this if you download and run the example code.
And you can check out a quick video I threw together of it all. The video show's off the example code that you can download off of my GitHub:
This afternoon I will be hooking up the Login and Registration to the server, as well as dumping that info locally into Core Data :)
And I don't feel right ending a post without a video! So enjoy watching a Machine Gun unloading on a Samuri Sword, and watch that Samuri Sword slice through the bullets! And you thought your Ginzu knife set rocked ;)
Cheers!