Created
April 25, 2014 12:32
-
-
Save wess/11288050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SEUserForm.m | |
// SurveyExample | |
// | |
// Created by Wess Cope on 4/24/14. | |
// Copyright (c) 2014 Wess Cope. All rights reserved. | |
// | |
#import "SEUserForm.h" | |
@implementation SEUserForm | |
- (SurveyTextField *)username | |
{ | |
if(_username) | |
return _username; | |
_username = [[SurveyTextField alloc] init]; | |
_username.returnKeyType = UIReturnKeyNext; | |
_username.shouldReturn = ^BOOL(SurveyTextField *field) { | |
[field moveToNextField]; | |
return NO; | |
}; | |
_username.shouldBeginEditing = ^BOOL(SurveyTextField *field) { | |
field.backgroundColor = nil; | |
field.placeholderColor = nil; | |
return YES; | |
}; | |
_username.onError = ^(SurveyTextField *field, NSDictionary *errors) { | |
field.backgroundColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.2]; | |
field.placeholderColor = [UIColor redColor]; | |
}; | |
return _username; | |
} | |
- (SurveyTextField *)password | |
{ | |
if(_password) | |
return _password; | |
_password = [[SurveyTextField alloc] init]; | |
_password.secureTextEntry = YES; | |
return _password; | |
} | |
+ (NSArray *)fields | |
{ | |
return @[@"username", @"password"]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment