├── .DS_Store ├── .gitignore ├── LICENSE ├── LRTextField.podspec ├── LRTextField ├── .DS_Store ├── LRTextField.h └── LRTextField.m ├── LRTextFieldExample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── LRTextFieldExample ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LRTextFieldExampleTests ├── Info.plist └── LRTextFieldExampleTests.m └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LR-Studio/LRSmartTextField/d1403e2ff2f6274847ec19f67810f1bb5d239ca8/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 LR-Studio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /LRTextField.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "LRTextField" 3 | s.version = "1.1.3" 4 | s.summary = "UITextField with label, validation and input mask on iOS." 5 | s.description = <<-DESC 6 | UITextField with label, validation and input mask on iOS, which is implemented by Objective-C. 7 | DESC 8 | 9 | s.homepage = "https://github.com/LR-Studio/LRTextField" 10 | # s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" 11 | s.license = 'MIT' 12 | s.author = { "LR Studio" => "lrlrstudio@gmail.com" } 13 | s.source = { :git => "https://github.com/LR-Studio/LRSmartTextField.git", :tag => s.version.to_s } 14 | # s.social_media_url = 'https://twitter.com/NAME' 15 | 16 | s.platform = :ios, '6.0' 17 | # s.ios.deployment_target = '5.0' 18 | # s.osx.deployment_target = '10.7' 19 | s.requires_arc = true 20 | 21 | s.source_files = 'LRTextField/*' 22 | # s.resources = 'Assets' 23 | 24 | # s.ios.exclude_files = 'Classes/osx' 25 | # s.osx.exclude_files = 'Classes/ios' 26 | # s.public_header_files = 'Classes/**/*.h' 27 | s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' 28 | end -------------------------------------------------------------------------------- /LRTextField/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LR-Studio/LRSmartTextField/d1403e2ff2f6274847ec19f67810f1bb5d239ca8/LRTextField/.DS_Store -------------------------------------------------------------------------------- /LRTextField/LRTextField.h: -------------------------------------------------------------------------------- 1 | // 2 | // LRTextField.h 3 | // LRTextField 4 | // 5 | // Created by LR Studio on 7/26/15. 6 | // Copyright (c) 2015 LR Studio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define VALIDATION_INDICATOR_YES @"YES" 12 | #define VALIDATION_INDICATOR_NO @"NO" 13 | #define VALIDATION_INDICATOR_COLOR @"VALIDATE_COLOR" 14 | 15 | @class LRTextField; 16 | 17 | typedef NS_ENUM(NSInteger, LRTextFieldStyle) 18 | { 19 | LRTextFieldStyleEmail, //Default placeholder: 'Email'; Default validation: email validation regular expression 20 | LRTextFieldStylePhone, //Default placeholder: 'Phone'; Default format: '###-###-####' 21 | LRTextFieldStylePassword, //Default placeholder: 'Password; Default: secure text entry 22 | LRTextFieldStyleNone, //Default style 23 | }; 24 | 25 | /** 26 | * Validation block to be applied to validate raw text synchronously or asynchronously. 27 | * @param text The raw text of the text field 28 | * @param textField 29 | * @return A dictionary with key of YES or NO and value of string to be displayed. 30 | */ 31 | typedef NSDictionary *(^ValidationBlock)(LRTextField *textField, NSString *text); 32 | 33 | IB_DESIGNABLE 34 | @interface LRTextField : UITextField 35 | 36 | - (instancetype) initWithFrame:(CGRect)frame; 37 | 38 | /** 39 | * Init with float label height 40 | * 41 | * @param frame The frame of text field 42 | * @param labelHeight Height of float label when displayed above textfield 43 | */ 44 | - (instancetype) initWithFrame:(CGRect)frame labelHeight:(CGFloat)labelHeight; 45 | 46 | /** 47 | * Init with float label height and pre-defined style 48 | * 49 | * @param frame The frame of text field 50 | * @param labelHeight Height of float label when displayed above textfield 51 | * @param style Pre-defined style 52 | */ 53 | - (instancetype) initWithFrame:(CGRect)frame labelHeight:(CGFloat)labelHeight style:(LRTextFieldStyle)style; 54 | 55 | /** 56 | * Style of text: email, phone, password 57 | * Default is nil. 58 | */ 59 | @property (nonatomic, assign) LRTextFieldStyle style; 60 | 61 | /** 62 | * Height of floating Label. 63 | * Default is 0.5 * self.frame.height 64 | */ 65 | @property (nonatomic, assign) IBInspectable CGFloat floatingLabelHeight; 66 | 67 | /** 68 | * Mask of input text. '#' represent any single character input 69 | * Default is nil. 70 | */ 71 | @property (nonatomic, copy) IBInspectable NSString *format; 72 | 73 | /** 74 | * Text without mask. 75 | * Default is nil. 76 | */ 77 | @property (nonatomic, copy, readonly) NSString *rawText; 78 | 79 | /** 80 | * Indicate whether the floating label animation is enabled. 81 | * Default is YES. 82 | */ 83 | @property (nonatomic) IBInspectable BOOL enableAnimation; 84 | 85 | /** 86 | * Text color to be applied to floating placeholder text when editing. 87 | * Default is tint color. 88 | */ 89 | @property (nonatomic, strong) IBInspectable UIColor *placeholderActiveColor; 90 | 91 | /** 92 | * Text color to be applied to floating placeholder text when not editing. 93 | * Default is 70% gray. 94 | */ 95 | @property (nonatomic, strong) IBInspectable UIColor *placeholderInactiveColor; 96 | 97 | /** 98 | * Text to be displayed in the floating hint label. 99 | * Default is nil. 100 | */ 101 | @property (nonatomic, copy) IBInspectable NSString *hintText; 102 | 103 | /** 104 | * Text color to be applied to the floating hint text. 105 | * Default is [UIColor grayColor]. 106 | */ 107 | @property (nonatomic, strong) IBInspectable UIColor *hintTextColor; 108 | 109 | /** 110 | * Set validation block. 111 | * 112 | * @param block The block to be applied to validate input text and return valid and invalid output. 113 | */ 114 | - (void) setValidationBlock:(ValidationBlock)block; 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /LRTextField/LRTextField.m: -------------------------------------------------------------------------------- 1 | // 2 | // LRTextField.m 3 | // LRTextField 4 | // 5 | // Created by LR Studio on 7/26/15. 6 | // Copyright (c) 2015 LR Studio. All rights reserved. 7 | // 8 | 9 | #import "LRTextField.h" 10 | 11 | @interface LRTextField () 12 | 13 | @property (nonatomic) UILabel *placeholderLabel; 14 | @property (nonatomic) UILabel *hintLabel; 15 | 16 | @property (nonatomic, assign) CGFloat placeholderXInset; 17 | @property (nonatomic, assign) CGFloat placeholderYInset; 18 | @property (nonatomic, strong) ValidationBlock validationBlock; 19 | @property (nonatomic, strong) NSString *temporaryString; 20 | @property (nonatomic, copy) NSString *placeholderText; 21 | 22 | @property (nonatomic, strong) UIColor *validationYesColor; 23 | @property (nonatomic, strong) UIColor *validationNoColor; 24 | 25 | @end 26 | 27 | @implementation LRTextField 28 | 29 | #pragma mark - Init Method 30 | 31 | - (instancetype) init 32 | { 33 | return [self initWithFrame:CGRectZero]; 34 | } 35 | 36 | - (instancetype) initWithFrame:(CGRect)frame 37 | { 38 | return [self initWithFrame:frame labelHeight:frame.size.height / 2]; 39 | } 40 | 41 | - (instancetype) initWithFrame:(CGRect)frame labelHeight:(CGFloat)labelHeight 42 | { 43 | return [self initWithFrame:frame labelHeight:labelHeight style:LRTextFieldStyleNone]; 44 | } 45 | 46 | - (instancetype) initWithFrame:(CGRect)frame labelHeight:(CGFloat)labelHeight style:(LRTextFieldStyle)style 47 | { 48 | self = [super initWithFrame:frame]; 49 | if ( self ) 50 | { 51 | _style = style; 52 | _floatingLabelHeight = labelHeight; 53 | self.borderStyle = UITextBorderStyleRoundedRect; 54 | [self updateUI]; 55 | } 56 | return self; 57 | } 58 | 59 | - (instancetype) initWithCoder:(NSCoder *)coder 60 | { 61 | self = [super initWithCoder:coder]; 62 | if ( self ) 63 | { 64 | _style = LRTextFieldStyleNone; 65 | _floatingLabelHeight = self.frame.size.height / 2; 66 | [self updateUI]; 67 | self.placeholder = self.placeholder; 68 | } 69 | return self; 70 | } 71 | 72 | #pragma mark - Access Method 73 | 74 | - (NSString *) rawText 75 | { 76 | if ( !_format ) 77 | { 78 | return self.text; 79 | } 80 | 81 | NSMutableString *mutableStr = [NSMutableString stringWithString:self.text]; 82 | for ( NSInteger i = self.text.length - 1; i >= 0; i-- ) 83 | { 84 | if ( [self.format characterAtIndex:i] != '#' ) 85 | { 86 | [mutableStr deleteCharactersInRange:NSMakeRange(i, 1)]; 87 | } 88 | } 89 | 90 | return mutableStr; 91 | } 92 | 93 | - (void) setText:(NSString *)text 94 | { 95 | if ( !_format ) 96 | { 97 | [super setText:text]; 98 | return; 99 | } 100 | 101 | [self renderString:text]; 102 | [self autoFillFormat]; 103 | } 104 | 105 | - (void) setFont:(UIFont *)font 106 | { 107 | [super setFont:font]; 108 | self.placeholderLabel.font = font; 109 | self.hintLabel.font = font; 110 | [self updatePlaceholder]; 111 | [self updateHint]; 112 | } 113 | 114 | - (void) setStyle:(LRTextFieldStyle)style 115 | { 116 | _style = style; 117 | [self updateStyle]; 118 | } 119 | 120 | - (void) setBorderStyle:(UITextBorderStyle)borderStyle 121 | { 122 | [super setBorderStyle:borderStyle]; 123 | [self initLayer]; 124 | } 125 | 126 | - (void) setFloatingLabelHeight:(CGFloat)floatingLabelHeight 127 | { 128 | _floatingLabelHeight = floatingLabelHeight; 129 | [self updatePlaceholder]; 130 | [self updateHint]; 131 | } 132 | 133 | - (void) setFormat:(NSString *)format 134 | { 135 | NSString *tmpString = self.rawText; 136 | _format = format; 137 | if ( tmpString ) 138 | { 139 | [self renderString:tmpString]; 140 | [self autoFillFormat]; 141 | } 142 | } 143 | 144 | - (void) setEnableAnimation:(BOOL)enableAnimation 145 | { 146 | _enableAnimation = enableAnimation; 147 | [self updatePlaceholder]; 148 | [self updateHint]; 149 | } 150 | 151 | - (void) setPlaceholder:(NSString *)placeholder 152 | { 153 | [super setPlaceholder:nil]; 154 | _placeholderText = placeholder; 155 | [self updatePlaceholder]; 156 | } 157 | 158 | - (void) setPlaceholderActiveColor:(UIColor *)placeholderActiveColor 159 | { 160 | _placeholderActiveColor = placeholderActiveColor; 161 | [self updatePlaceholder]; 162 | } 163 | 164 | - (void) setPlaceholderInactiveColor:(UIColor *)placeholderInactiveColor 165 | { 166 | _placeholderInactiveColor = placeholderInactiveColor; 167 | [self updatePlaceholder]; 168 | } 169 | 170 | - (void) setHintText:(NSString *)hintText 171 | { 172 | _hintText = hintText; 173 | [self updateHint]; 174 | } 175 | 176 | - (void) setHintTextColor:(UIColor *)hintTextColor 177 | { 178 | _hintTextColor = hintTextColor; 179 | [self updateHint]; 180 | } 181 | 182 | - (void) setValidationBlock:(ValidationBlock)block 183 | { 184 | _validationBlock = block; 185 | [self initLayer]; 186 | } 187 | 188 | #pragma mark - Update Method 189 | 190 | - (void) updateUI 191 | { 192 | [self propertyInit]; 193 | 194 | self.backgroundColor = [UIColor clearColor]; 195 | 196 | self.placeholderLabel = [UILabel new]; 197 | self.placeholderLabel.backgroundColor = [UIColor clearColor]; 198 | self.placeholderLabel.font = self.font; 199 | 200 | self.hintLabel = [UILabel new]; 201 | self.hintLabel.backgroundColor = [UIColor clearColor]; 202 | self.hintLabel.font = self.font; 203 | 204 | [self updatePlaceholder]; 205 | [self updateHint]; 206 | 207 | [self addSubview:self.placeholderLabel]; 208 | [self addSubview:self.hintLabel]; 209 | 210 | [self addTarget:self action:@selector(textFieldEdittingDidBeginInternal:) forControlEvents:UIControlEventEditingDidBegin]; 211 | [self addTarget:self action:@selector(textFieldEdittingDidChangeInternal:) forControlEvents:UIControlEventEditingChanged]; 212 | [self addTarget:self action:@selector(textFieldEdittingDidEndInternal:) forControlEvents:UIControlEventEditingDidEnd]; 213 | 214 | [self updateStyle]; 215 | } 216 | 217 | - (void) propertyInit 218 | { 219 | //set up default values for view 220 | _placeholderXInset = 0; 221 | _placeholderYInset = 1; 222 | 223 | _enableAnimation = YES; 224 | _placeholderInactiveColor = [[UIColor grayColor] colorWithAlphaComponent:0.7]; 225 | if ([[UIDevice currentDevice].systemVersion floatValue] >= 7) { 226 | _placeholderActiveColor = self.tintColor; 227 | } 228 | _hintText = nil; 229 | _hintTextColor = [[UIColor grayColor] colorWithAlphaComponent:0.7]; 230 | _temporaryString = [NSString string]; 231 | _validationBlock = nil; 232 | self.clipsToBounds = NO; 233 | 234 | //set default color for validation text 235 | _validationYesColor = [UIColor colorWithRed:35.0/255.0 green:199.0/255.0 blue:90.0/255.0 alpha:1.0]; 236 | _validationNoColor = [UIColor colorWithRed:225.0/255.0 green:51.0/255.0 blue:40.0/255.0 alpha:1.0]; 237 | 238 | //init layer.borderColor for validation 239 | [self initLayer]; 240 | } 241 | 242 | - (void) updatePlaceholder 243 | { 244 | self.placeholderLabel.text = self.placeholderText; 245 | //Label shown over the textfield 246 | if ( self.isEditing || self.text.length > 0 || !self.enableAnimation ) 247 | { 248 | CGFloat scale = _floatingLabelHeight / self.font.lineHeight; 249 | self.placeholderLabel.transform = CGAffineTransformMakeScale(scale, scale); 250 | self.placeholderLabel.frame = [self floatingLabelUpperFrame]; 251 | }else 252 | { 253 | //Label shown the same as placeholder 254 | self.placeholderLabel.transform = CGAffineTransformMakeScale(1.0, 1.0); 255 | self.placeholderLabel.frame = [super textRectForBounds:self.bounds]; 256 | } 257 | 258 | if ( self.isEditing ) 259 | { 260 | self.placeholderLabel.textColor = self.placeholderActiveColor; 261 | } 262 | else 263 | { 264 | self.placeholderLabel.textColor = self.placeholderInactiveColor; 265 | } 266 | } 267 | 268 | - (void) updateHint 269 | { 270 | self.hintLabel.text = self.hintText; 271 | self.hintLabel.textColor = self.hintTextColor; 272 | CGFloat scale = _floatingLabelHeight / self.font.lineHeight; 273 | self.hintLabel.transform = CGAffineTransformMakeScale(scale, scale); 274 | self.hintLabel.frame = [self floatingLabelUpperFrame]; 275 | self.hintLabel.textAlignment = NSTextAlignmentRight; 276 | if ( self.isEditing || self.text.length > 0 || !self.enableAnimation ) 277 | { 278 | self.hintLabel.alpha = 1.0f; 279 | } 280 | else 281 | { 282 | self.hintLabel.alpha = 0.0f; 283 | } 284 | } 285 | 286 | - (void) updateStyle 287 | { 288 | switch ( self.style ) 289 | { 290 | case LRTextFieldStyleEmail: 291 | self.placeholder = @"Email"; 292 | self.format = nil; 293 | self.validationBlock = ^NSDictionary *(LRTextField *textField, NSString *text) { 294 | NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}"; 295 | NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; 296 | if ( ![emailTest evaluateWithObject:text] ) 297 | { 298 | return @{ VALIDATION_INDICATOR_NO : @"Invalid Email" }; 299 | } 300 | return @{}; 301 | }; 302 | break; 303 | case LRTextFieldStylePhone: 304 | self.placeholder = @"Phone"; 305 | self.keyboardType = UIKeyboardTypePhonePad; 306 | self.format = @"(###)###-####"; 307 | break; 308 | case LRTextFieldStylePassword: 309 | self.placeholder = @"Password"; 310 | self.secureTextEntry = YES; 311 | break; 312 | default: 313 | break; 314 | } 315 | } 316 | 317 | #pragma mark - Target Method 318 | 319 | - (IBAction) textFieldEdittingDidBeginInternal:(UITextField *)sender 320 | { 321 | [self showBorderWithColor:[UIColor clearColor]]; 322 | [self runDidBeginAnimation]; 323 | } 324 | 325 | - (IBAction) textFieldEdittingDidEndInternal:(UITextField *)sender 326 | { 327 | [self autoFillFormat]; 328 | [self runDidEndAnimation]; 329 | } 330 | 331 | - (IBAction) textFieldEdittingDidChangeInternal:(UITextField *)sender 332 | { 333 | [self runDidChange]; 334 | } 335 | 336 | #pragma mark - Private Method 337 | 338 | - (void) sanitizeStrings 339 | { 340 | NSString * currentText = self.text; 341 | if ( currentText.length > self.format.length ) 342 | { 343 | self.text = self.temporaryString; 344 | return; 345 | } 346 | 347 | [self renderString:currentText]; 348 | } 349 | 350 | - (void) renderString:(NSString *)raw 351 | { 352 | NSMutableString * result = [[NSMutableString alloc] init]; 353 | int last = 0; 354 | for ( int i = 0; i < self.format.length; i++ ) 355 | { 356 | if ( last >= raw.length ) 357 | break; 358 | unichar charAtMask = [self.format characterAtIndex:i]; 359 | unichar charAtCurrent = [raw characterAtIndex:last]; 360 | if ( charAtMask == '#' ) 361 | { 362 | [result appendString:[NSString stringWithFormat:@"%c",charAtCurrent]]; 363 | } 364 | else 365 | { 366 | [result appendString:[NSString stringWithFormat:@"%c",charAtMask]]; 367 | if (charAtCurrent != charAtMask) 368 | last--; 369 | } 370 | last++; 371 | } 372 | 373 | [super setText:result]; 374 | self.temporaryString = self.text; 375 | } 376 | 377 | - (void) autoFillFormat 378 | { 379 | NSMutableString *result = [NSMutableString stringWithString:self.text]; 380 | for ( NSInteger i = self.text.length; i < self.format.length; i++ ) 381 | { 382 | unichar charAtMask = [self.format characterAtIndex:i]; 383 | if ( charAtMask == '#' ) 384 | { 385 | return; 386 | } 387 | [result appendFormat:@"%c", charAtMask]; 388 | } 389 | [super setText:result]; 390 | self.temporaryString = self.text; 391 | } 392 | 393 | - (void) runDidBeginAnimation 394 | { 395 | if ( self.text.length > 0 || !_enableAnimation) 396 | { 397 | void (^showPlaceholderBlock)() = ^{ 398 | self.placeholderLabel.textColor = self.placeholderActiveColor; 399 | }; 400 | 401 | void (^showHintBlock)() = ^{ 402 | self.hintLabel.text = self.hintText; 403 | self.hintLabel.textColor = self.hintTextColor; 404 | self.hintLabel.alpha = 1.0f; 405 | }; 406 | 407 | [UIView transitionWithView:self.placeholderLabel 408 | duration:0.3f 409 | options:UIViewAnimationOptionBeginFromCurrentState 410 | | UIViewAnimationOptionTransitionCrossDissolve 411 | animations:showPlaceholderBlock 412 | completion:nil]; 413 | 414 | [UIView transitionWithView:self.hintLabel 415 | duration:0.3f 416 | options:UIViewAnimationOptionBeginFromCurrentState 417 | | UIViewAnimationOptionTransitionCrossDissolve 418 | animations:showHintBlock 419 | completion:nil]; 420 | } 421 | else 422 | { 423 | 424 | void (^showBlock)() = ^{ 425 | [self updatePlaceholder]; 426 | self.hintLabel.text = self.hintText; 427 | self.hintLabel.alpha = 1.0f; 428 | }; 429 | [UIView animateWithDuration:0.3f animations:showBlock]; 430 | } 431 | } 432 | 433 | - (void) runDidEndAnimation 434 | { 435 | if ( self.text.length > 0 || !_enableAnimation) 436 | { 437 | if ( self.validationBlock ) 438 | { 439 | [self validateText]; 440 | } 441 | 442 | void (^hideBlock)() = ^{ 443 | self.placeholderLabel.textColor = self.placeholderInactiveColor; 444 | }; 445 | [UIView transitionWithView:self.placeholderLabel 446 | duration:0.3f 447 | options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionTransitionCrossDissolve 448 | animations:hideBlock 449 | completion:nil]; 450 | } 451 | else 452 | { 453 | void (^hideBlock)() = ^{ 454 | [self updatePlaceholder]; 455 | [self updateHint]; 456 | }; 457 | [UIView animateWithDuration:0.3 animations:hideBlock]; 458 | } 459 | } 460 | 461 | - (void) runDidChange 462 | { 463 | if ( !_format ) 464 | { 465 | return; 466 | } 467 | 468 | [self sanitizeStrings]; 469 | } 470 | 471 | #pragma mark - Validation 472 | 473 | - (void) validateText 474 | { 475 | UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 476 | indicator.frame = CGRectMake(self.frame.size.width - self.frame.size.height, 477 | 0, 478 | self.frame.size.height, 479 | self.frame.size.height); 480 | [self.layer addSublayer:indicator.layer]; 481 | [indicator startAnimating]; 482 | __weak typeof(self) weakSelf = self; 483 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 484 | NSDictionary *validationInfo = weakSelf.validationBlock(weakSelf, weakSelf.rawText); 485 | if ( [validationInfo objectForKey:VALIDATION_INDICATOR_COLOR] ) { 486 | _validationYesColor = [validationInfo objectForKey:VALIDATION_INDICATOR_COLOR]; 487 | } 488 | if ( [validationInfo objectForKey:VALIDATION_INDICATOR_COLOR] ) { 489 | _validationNoColor = [validationInfo objectForKey:VALIDATION_INDICATOR_COLOR]; 490 | } 491 | 492 | dispatch_async(dispatch_get_main_queue(), ^{ 493 | [indicator stopAnimating]; 494 | [weakSelf.rightView removeFromSuperview]; 495 | weakSelf.rightView = nil; 496 | [self runValidationViewAnimation:validationInfo]; 497 | }); 498 | }); 499 | } 500 | 501 | - (void) runValidationViewAnimation:(NSDictionary *)validationInfo 502 | { 503 | [UIView transitionWithView:self.hintLabel duration:0.3f options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionTransitionCrossDissolve animations:^{ 504 | [self layoutValidationView:validationInfo]; 505 | } completion:nil]; 506 | 507 | if ( [validationInfo objectForKey:VALIDATION_INDICATOR_YES] ) 508 | { 509 | [self showBorderWithColor:_validationYesColor]; 510 | }else if ( [validationInfo objectForKey:VALIDATION_INDICATOR_NO] ) 511 | { 512 | [self showBorderWithColor:_validationNoColor]; 513 | } 514 | } 515 | 516 | - (void) layoutValidationView:(NSDictionary *)validationInfo 517 | { 518 | 519 | if ( [validationInfo objectForKey:VALIDATION_INDICATOR_YES] ) 520 | { 521 | self.hintLabel.text = [[validationInfo objectForKey:VALIDATION_INDICATOR_YES] isKindOfClass:[NSString class]] ? [validationInfo objectForKey:VALIDATION_INDICATOR_YES] : @""; 522 | self.hintLabel.textColor = _validationYesColor; 523 | self.hintLabel.alpha = 1.0f; 524 | } 525 | else if ( [validationInfo objectForKey:VALIDATION_INDICATOR_NO] ) 526 | { 527 | self.hintLabel.text = [[validationInfo objectForKey:VALIDATION_INDICATOR_NO] isKindOfClass:[NSString class]] ? [validationInfo objectForKey:VALIDATION_INDICATOR_NO] : @""; 528 | self.hintLabel.textColor = _validationNoColor; 529 | self.hintLabel.alpha = 1.0f; 530 | } 531 | } 532 | 533 | - (void) initLayer 534 | { 535 | switch ( self.borderStyle ) 536 | { 537 | case UITextBorderStyleRoundedRect: 538 | self.layer.borderWidth = 1.0f; 539 | self.layer.cornerRadius = 6.0f; 540 | self.layer.borderColor = [UIColor clearColor].CGColor; 541 | break; 542 | case UITextBorderStyleLine: 543 | self.layer.borderWidth = 1.0f; 544 | self.layer.cornerRadius = 0.0f; 545 | self.layer.borderColor = [UIColor clearColor].CGColor; 546 | break; 547 | case UITextBorderStyleBezel: 548 | self.layer.borderWidth = 2.0f; 549 | self.layer.cornerRadius = 0.0f; 550 | self.layer.borderColor = [UIColor clearColor].CGColor; 551 | break; 552 | case UITextBorderStyleNone: 553 | self.layer.borderWidth = 0.0f; 554 | break; 555 | default: 556 | break; 557 | } 558 | } 559 | 560 | - (void) showBorderWithColor:(UIColor*)color 561 | { 562 | CABasicAnimation *showColorAnimation = [CABasicAnimation animationWithKeyPath:@"borderColor"]; 563 | showColorAnimation.fromValue = (__bridge id)(self.layer.borderColor); 564 | showColorAnimation.toValue = (__bridge id)(color.CGColor); 565 | showColorAnimation.duration = 0.3; 566 | [self.layer addAnimation:showColorAnimation forKey:@"borderColor"]; 567 | self.layer.borderColor = color.CGColor; 568 | } 569 | 570 | - (CGRect) floatingLabelUpperFrame 571 | { 572 | return CGRectMake(self.placeholderXInset, - self.placeholderYInset - self.floatingLabelHeight, self.bounds.size.width - 2 * self.placeholderXInset, self.floatingLabelHeight); 573 | } 574 | 575 | @end 576 | -------------------------------------------------------------------------------- /LRTextFieldExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 56A3FAC81B6CB09200F70843 /* LRTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 56A3FAC71B6CB09200F70843 /* LRTextField.m */; }; 11 | E585FF151B6CA668003CBD4A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E585FF141B6CA668003CBD4A /* main.m */; }; 12 | E585FF181B6CA668003CBD4A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E585FF171B6CA668003CBD4A /* AppDelegate.m */; }; 13 | E585FF1B1B6CA668003CBD4A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E585FF1A1B6CA668003CBD4A /* ViewController.m */; }; 14 | E585FF1E1B6CA668003CBD4A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E585FF1C1B6CA668003CBD4A /* Main.storyboard */; }; 15 | E585FF201B6CA668003CBD4A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E585FF1F1B6CA668003CBD4A /* Images.xcassets */; }; 16 | E585FF231B6CA668003CBD4A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E585FF211B6CA668003CBD4A /* LaunchScreen.xib */; }; 17 | E585FF2F1B6CA668003CBD4A /* LRTextFieldExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E585FF2E1B6CA668003CBD4A /* LRTextFieldExampleTests.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | E585FF291B6CA668003CBD4A /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = E585FF071B6CA668003CBD4A /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = E585FF0E1B6CA668003CBD4A; 26 | remoteInfo = LRTextFieldExample; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 56A3FAC61B6CB09200F70843 /* LRTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LRTextField.h; path = LRTextField/LRTextField.h; sourceTree = ""; }; 32 | 56A3FAC71B6CB09200F70843 /* LRTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LRTextField.m; path = LRTextField/LRTextField.m; sourceTree = ""; }; 33 | E585FF0F1B6CA668003CBD4A /* LRTextFieldExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LRTextFieldExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | E585FF131B6CA668003CBD4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | E585FF141B6CA668003CBD4A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | E585FF161B6CA668003CBD4A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | E585FF171B6CA668003CBD4A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | E585FF191B6CA668003CBD4A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | E585FF1A1B6CA668003CBD4A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | E585FF1D1B6CA668003CBD4A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | E585FF1F1B6CA668003CBD4A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | E585FF221B6CA668003CBD4A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | E585FF281B6CA668003CBD4A /* LRTextFieldExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LRTextFieldExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | E585FF2D1B6CA668003CBD4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | E585FF2E1B6CA668003CBD4A /* LRTextFieldExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LRTextFieldExampleTests.m; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | E585FF0C1B6CA668003CBD4A /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | E585FF251B6CA668003CBD4A /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | E585FF061B6CA668003CBD4A = { 67 | isa = PBXGroup; 68 | children = ( 69 | E585FF111B6CA668003CBD4A /* LRTextFieldExample */, 70 | E585FF381B6CA697003CBD4A /* LRTextField */, 71 | E585FF2B1B6CA668003CBD4A /* LRTextFieldExampleTests */, 72 | E585FF101B6CA668003CBD4A /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | E585FF101B6CA668003CBD4A /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | E585FF0F1B6CA668003CBD4A /* LRTextFieldExample.app */, 80 | E585FF281B6CA668003CBD4A /* LRTextFieldExampleTests.xctest */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | E585FF111B6CA668003CBD4A /* LRTextFieldExample */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | E585FF161B6CA668003CBD4A /* AppDelegate.h */, 89 | E585FF171B6CA668003CBD4A /* AppDelegate.m */, 90 | E585FF191B6CA668003CBD4A /* ViewController.h */, 91 | E585FF1A1B6CA668003CBD4A /* ViewController.m */, 92 | E585FF1C1B6CA668003CBD4A /* Main.storyboard */, 93 | E585FF1F1B6CA668003CBD4A /* Images.xcassets */, 94 | E585FF211B6CA668003CBD4A /* LaunchScreen.xib */, 95 | E585FF121B6CA668003CBD4A /* Supporting Files */, 96 | ); 97 | path = LRTextFieldExample; 98 | sourceTree = ""; 99 | }; 100 | E585FF121B6CA668003CBD4A /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | E585FF131B6CA668003CBD4A /* Info.plist */, 104 | E585FF141B6CA668003CBD4A /* main.m */, 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | E585FF2B1B6CA668003CBD4A /* LRTextFieldExampleTests */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | E585FF2E1B6CA668003CBD4A /* LRTextFieldExampleTests.m */, 113 | E585FF2C1B6CA668003CBD4A /* Supporting Files */, 114 | ); 115 | path = LRTextFieldExampleTests; 116 | sourceTree = ""; 117 | }; 118 | E585FF2C1B6CA668003CBD4A /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | E585FF2D1B6CA668003CBD4A /* Info.plist */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | E585FF381B6CA697003CBD4A /* LRTextField */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 56A3FAC61B6CB09200F70843 /* LRTextField.h */, 130 | 56A3FAC71B6CB09200F70843 /* LRTextField.m */, 131 | ); 132 | name = LRTextField; 133 | sourceTree = ""; 134 | }; 135 | /* End PBXGroup section */ 136 | 137 | /* Begin PBXNativeTarget section */ 138 | E585FF0E1B6CA668003CBD4A /* LRTextFieldExample */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = E585FF321B6CA668003CBD4A /* Build configuration list for PBXNativeTarget "LRTextFieldExample" */; 141 | buildPhases = ( 142 | E585FF0B1B6CA668003CBD4A /* Sources */, 143 | E585FF0C1B6CA668003CBD4A /* Frameworks */, 144 | E585FF0D1B6CA668003CBD4A /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | ); 150 | name = LRTextFieldExample; 151 | productName = LRTextFieldExample; 152 | productReference = E585FF0F1B6CA668003CBD4A /* LRTextFieldExample.app */; 153 | productType = "com.apple.product-type.application"; 154 | }; 155 | E585FF271B6CA668003CBD4A /* LRTextFieldExampleTests */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = E585FF351B6CA668003CBD4A /* Build configuration list for PBXNativeTarget "LRTextFieldExampleTests" */; 158 | buildPhases = ( 159 | E585FF241B6CA668003CBD4A /* Sources */, 160 | E585FF251B6CA668003CBD4A /* Frameworks */, 161 | E585FF261B6CA668003CBD4A /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | E585FF2A1B6CA668003CBD4A /* PBXTargetDependency */, 167 | ); 168 | name = LRTextFieldExampleTests; 169 | productName = LRTextFieldExampleTests; 170 | productReference = E585FF281B6CA668003CBD4A /* LRTextFieldExampleTests.xctest */; 171 | productType = "com.apple.product-type.bundle.unit-test"; 172 | }; 173 | /* End PBXNativeTarget section */ 174 | 175 | /* Begin PBXProject section */ 176 | E585FF071B6CA668003CBD4A /* Project object */ = { 177 | isa = PBXProject; 178 | attributes = { 179 | LastUpgradeCheck = 0630; 180 | ORGANIZATIONNAME = "LR Studio"; 181 | TargetAttributes = { 182 | E585FF0E1B6CA668003CBD4A = { 183 | CreatedOnToolsVersion = 6.3.1; 184 | }; 185 | E585FF271B6CA668003CBD4A = { 186 | CreatedOnToolsVersion = 6.3.1; 187 | TestTargetID = E585FF0E1B6CA668003CBD4A; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = E585FF0A1B6CA668003CBD4A /* Build configuration list for PBXProject "LRTextFieldExample" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = E585FF061B6CA668003CBD4A; 200 | productRefGroup = E585FF101B6CA668003CBD4A /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | E585FF0E1B6CA668003CBD4A /* LRTextFieldExample */, 205 | E585FF271B6CA668003CBD4A /* LRTextFieldExampleTests */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | E585FF0D1B6CA668003CBD4A /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | E585FF1E1B6CA668003CBD4A /* Main.storyboard in Resources */, 216 | E585FF231B6CA668003CBD4A /* LaunchScreen.xib in Resources */, 217 | E585FF201B6CA668003CBD4A /* Images.xcassets in Resources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | E585FF261B6CA668003CBD4A /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXResourcesBuildPhase section */ 229 | 230 | /* Begin PBXSourcesBuildPhase section */ 231 | E585FF0B1B6CA668003CBD4A /* Sources */ = { 232 | isa = PBXSourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | E585FF1B1B6CA668003CBD4A /* ViewController.m in Sources */, 236 | E585FF181B6CA668003CBD4A /* AppDelegate.m in Sources */, 237 | E585FF151B6CA668003CBD4A /* main.m in Sources */, 238 | 56A3FAC81B6CB09200F70843 /* LRTextField.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | E585FF241B6CA668003CBD4A /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | E585FF2F1B6CA668003CBD4A /* LRTextFieldExampleTests.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXTargetDependency section */ 253 | E585FF2A1B6CA668003CBD4A /* PBXTargetDependency */ = { 254 | isa = PBXTargetDependency; 255 | target = E585FF0E1B6CA668003CBD4A /* LRTextFieldExample */; 256 | targetProxy = E585FF291B6CA668003CBD4A /* PBXContainerItemProxy */; 257 | }; 258 | /* End PBXTargetDependency section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | E585FF1C1B6CA668003CBD4A /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | E585FF1D1B6CA668003CBD4A /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | E585FF211B6CA668003CBD4A /* LaunchScreen.xib */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | E585FF221B6CA668003CBD4A /* Base */, 273 | ); 274 | name = LaunchScreen.xib; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | E585FF301B6CA668003CBD4A /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu99; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | TARGETED_DEVICE_FAMILY = "1,2"; 321 | }; 322 | name = Debug; 323 | }; 324 | E585FF311B6CA668003CBD4A /* Release */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 355 | MTL_ENABLE_DEBUG_INFO = NO; 356 | SDKROOT = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | VALIDATE_PRODUCT = YES; 359 | }; 360 | name = Release; 361 | }; 362 | E585FF331B6CA668003CBD4A /* Debug */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | INFOPLIST_FILE = LRTextFieldExample/Info.plist; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | }; 370 | name = Debug; 371 | }; 372 | E585FF341B6CA668003CBD4A /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | INFOPLIST_FILE = LRTextFieldExample/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 378 | PRODUCT_NAME = "$(TARGET_NAME)"; 379 | }; 380 | name = Release; 381 | }; 382 | E585FF361B6CA668003CBD4A /* Debug */ = { 383 | isa = XCBuildConfiguration; 384 | buildSettings = { 385 | BUNDLE_LOADER = "$(TEST_HOST)"; 386 | FRAMEWORK_SEARCH_PATHS = ( 387 | "$(SDKROOT)/Developer/Library/Frameworks", 388 | "$(inherited)", 389 | ); 390 | GCC_PREPROCESSOR_DEFINITIONS = ( 391 | "DEBUG=1", 392 | "$(inherited)", 393 | ); 394 | INFOPLIST_FILE = LRTextFieldExampleTests/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LRTextFieldExample.app/LRTextFieldExample"; 398 | }; 399 | name = Debug; 400 | }; 401 | E585FF371B6CA668003CBD4A /* Release */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | BUNDLE_LOADER = "$(TEST_HOST)"; 405 | FRAMEWORK_SEARCH_PATHS = ( 406 | "$(SDKROOT)/Developer/Library/Frameworks", 407 | "$(inherited)", 408 | ); 409 | INFOPLIST_FILE = LRTextFieldExampleTests/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LRTextFieldExample.app/LRTextFieldExample"; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | E585FF0A1B6CA668003CBD4A /* Build configuration list for PBXProject "LRTextFieldExample" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | E585FF301B6CA668003CBD4A /* Debug */, 423 | E585FF311B6CA668003CBD4A /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | E585FF321B6CA668003CBD4A /* Build configuration list for PBXNativeTarget "LRTextFieldExample" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | E585FF331B6CA668003CBD4A /* Debug */, 432 | E585FF341B6CA668003CBD4A /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | E585FF351B6CA668003CBD4A /* Build configuration list for PBXNativeTarget "LRTextFieldExampleTests" */ = { 438 | isa = XCConfigurationList; 439 | buildConfigurations = ( 440 | E585FF361B6CA668003CBD4A /* Debug */, 441 | E585FF371B6CA668003CBD4A /* Release */, 442 | ); 443 | defaultConfigurationIsVisible = 0; 444 | defaultConfigurationName = Release; 445 | }; 446 | /* End XCConfigurationList section */ 447 | }; 448 | rootObject = E585FF071B6CA668003CBD4A /* Project object */; 449 | } 450 | -------------------------------------------------------------------------------- /LRTextFieldExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LRTextFieldExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LRTextFieldExample 4 | // 5 | // Created by Chao Li on 8/1/15. 6 | // Copyright (c) 2015 LR Studio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LRTextFieldExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LRTextFieldExample 4 | // 5 | // Created by Chao Li on 8/1/15. 6 | // Copyright (c) 2015 LR Studio. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LRTextFieldExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LRTextFieldExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 37 | 46 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /LRTextFieldExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LRTextFieldExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | lrstudio.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LRTextFieldExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LRTextField 4 | // 5 | // Created by Chao on 7/26/15. 6 | // Copyright (c) 2015 Chao. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LRTextField.h" 11 | @interface ViewController : UIViewController 12 | 13 | @property (weak, nonatomic) IBOutlet LRTextField *test; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LRTextFieldExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LRTextField 4 | // 5 | // Created by Chao on 7/26/15. 6 | // Copyright (c) 2015 Chao. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LRTextField.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | LRTextField *textFieldEmail = [[LRTextField alloc] initWithFrame:CGRectMake(20, 70, 260, 30) labelHeight:15 style:LRTextFieldStyleEmail]; // init with pre-defined style 22 | [self.view addSubview:textFieldEmail]; 23 | 24 | LRTextField *textFieldPhone = [[LRTextField alloc] initWithFrame:CGRectMake(20, 150, 260, 30) labelHeight:15]; 25 | textFieldPhone.placeholder = @"Phone"; 26 | textFieldPhone.hintText = @"(Optional)"; 27 | textFieldPhone.format = @"(###)###-####"; // set format for segment input string 28 | textFieldPhone.keyboardType = UIKeyboardTypePhonePad; 29 | [self.view addSubview:textFieldPhone]; 30 | 31 | LRTextField *textFieldValidation = [[LRTextField alloc] initWithFrame:CGRectMake(20, 240, 260, 30) labelHeight:15]; 32 | textFieldValidation.placeholder = @"Validation Demo"; 33 | textFieldValidation.hintText = @"Enter \"abc\""; 34 | [textFieldValidation setValidationBlock:^NSDictionary *(LRTextField *textField, NSString *text) { 35 | [NSThread sleepForTimeInterval:1.0]; 36 | if ([text isEqualToString:@"abc"]) { 37 | return @{ VALIDATION_INDICATOR_YES : @"Correct" }; 38 | } 39 | return @{ VALIDATION_INDICATOR_NO : @"Error" }; 40 | }]; 41 | [self.view addSubview:textFieldValidation]; 42 | 43 | LRTextField *textFieldCustom = [[LRTextField alloc] initWithFrame:CGRectMake(20, 320, 260, 30) labelHeight:15]; 44 | textFieldCustom.placeholder = @"Placeholder"; 45 | textFieldCustom.placeholderActiveColor = [UIColor redColor]; 46 | textFieldCustom.placeholderInactiveColor = [UIColor blackColor]; 47 | textFieldCustom.hintText = @"Purple hint"; 48 | textFieldCustom.hintTextColor = [UIColor purpleColor]; 49 | textFieldCustom.enableAnimation = NO; 50 | [self.view addSubview:textFieldCustom]; 51 | 52 | // Do any additional setup after loading the view, typically from a nib. 53 | } 54 | 55 | - (void)didReceiveMemoryWarning { 56 | [super didReceiveMemoryWarning]; 57 | // Dispose of any resources that can be recreated. 58 | } 59 | - (IBAction)hideKeyboardPressed:(id)sender 60 | { 61 | [self.view endEditing:YES]; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /LRTextFieldExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LRTextFieldExample 4 | // 5 | // Created by Chao Li on 8/1/15. 6 | // Copyright (c) 2015 LR Studio. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LRTextFieldExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | lrstudio.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LRTextFieldExampleTests/LRTextFieldExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LRTextFieldExampleTests.m 3 | // LRTextFieldExampleTests 4 | // 5 | // Created by Chao Li on 8/1/15. 6 | // Copyright (c) 2015 LR Studio. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LRTextFieldExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation LRTextFieldExampleTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LRTextField 2 | =========== 3 | A subclass of UITextField that supports float label, validation, inputmask, and `IB_DESIGNABLE` (Xcode 6). The expectation is that our text field can offer great functionality, while keeping the original design. 4 | 5 | ### How to install 6 | ``` 7 | pod 'LRTextField' 8 | ``` 9 | 10 | 11 | ### USAGE 12 | __Init with code__ 13 | 14 | ![Email](http://i.imgur.com/GDDVduN.gif) 15 | ``` objc 16 | // init with pre-defined style 17 | LRTextField *textFieldEmail = [[LRTextField alloc] initWithFrame:CGRectMake(20, 70, 260, 30) labelHeight:15 style:LRTextFieldStyleEmail]; 18 | [self.view addSubview:textFieldEmail]; 19 | ``` 20 | 21 | 22 | ![Phone](http://i.imgur.com/w20VsY1.gif) 23 | ``` objc 24 | LRTextField *textFieldPhone = [[LRTextField alloc] initWithFrame:CGRectMake(20, 150, 260, 30) labelHeight:15]; 25 | textFieldPhone.placeholder = @"Phone"; 26 | textFieldPhone.hintText = @"(Optional)"; 27 | textFieldPhone.format = @"(###)###-####"; // set format for segment input string 28 | textFieldPhone.keyboardType = UIKeyboardTypePhonePad; 29 | [self.view addSubview:textFieldPhone]; 30 | ``` 31 | 32 | 33 | ![Validation](http://i.imgur.com/IiryMXj.gif) 34 | ``` objc 35 | LRTextField *textFieldValidation = [[LRTextField alloc] initWithFrame:CGRectMake(20, 240, 260, 30) labelHeight:15]; 36 | textFieldValidation.placeholder = @"Validation Demo"; 37 | textFieldValidation.hintText = @"Enter \"abc\""; 38 | [textFieldValidation setValidationBlock:^NSDictionary *(LRTextField *textField, NSString *text) { 39 | [NSThread sleepForTimeInterval:1.0]; 40 | if ([text isEqualToString:@"abc"]) { 41 | return @{ VALIDATION_INDICATOR_YES : @"Correct" }; 42 | } 43 | return @{ VALIDATION_INDICATOR_NO : @"Error" }; 44 | }]; 45 | [self.view addSubview:textFieldValidation]; 46 | ``` 47 | 48 | 49 | __Init in Storyboard / Xib__ 50 | 51 | ![SB-result](http://i.imgur.com/wCq56nz.gif) 52 | 53 | ![SB-how](http://i.imgur.com/xz3PuX5.gif) 54 | 55 | 56 | ### CUSTOMIZE 57 | __Color__ 58 | 59 | ![color](http://i.imgur.com/lp2vSfV.gif) 60 | 61 | ``` objc 62 | LRTextField *textFieldCustom = [[LRTextField alloc] initWithFrame:CGRectMake(20, 320, 260, 30) labelHeight:15]; 63 | textFieldCustom.placeholder = @"Placeholder"; 64 | textFieldCustom.placeholderActiveColor = [UIColor redColor]; 65 | textFieldCustom.placeholderInactiveColor = [UIColor blackColor]; 66 | textFieldCustom.hintText = @"Purple hint"; 67 | textFieldCustom.hintTextColor = [UIColor purpleColor]; 68 | [self.view addSubview:textFieldCustom]; 69 | ``` 70 | 71 | __Disable Animation__ 72 | 73 | ![noanimation](http://i.imgur.com/aBJu8Ol.gif) 74 | 75 | ``` objc 76 | textFieldCustom.enableAnimation = NO; 77 | ``` 78 | ### TROUBLESHOOTING 79 | Please send an email lrlrstudio@gmail.com 80 | --------------------------------------------------------------------------------