Skip to content

Instantly share code, notes, and snippets.

@wess
Created April 25, 2014 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wess/11288050 to your computer and use it in GitHub Desktop.
Save wess/11288050 to your computer and use it in GitHub Desktop.
//
// 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