AETetFieldValidator 是受 TextFieldValidator 项目启发,大部分逻辑代码来自那里。它是一个轻量级、可自定义的 UITextField 子类,支持多个正则表达式验证,并提供简单的界面以提供验证反馈。
有关 TextFieldValidator 的原始博客文章的详细信息,请参阅:https://dhawaldawar.wordpress.com/2014/06/11/uitextfield-validation-ios/
A lightweight, customizable subclass of UITextField that supports multiple regex validations and provides a simple UI to provide validation feedback. And rewrite to support appearance
[[TextFieldValidator appearance] setPopUpColor:[UIColor orangeColor]];
UIImage* img = [UIImage imageNamed:@"customError"];
[[TextFieldValidator appearance] setErrorImg:img];
[[TextFieldValidator appearance] setPopUpShadowColor:[UIColor darkGrayColor]];
[[TextFieldValidator appearance] setPopUpShadowRadius:3.0f];
[[TextFieldValidator appearance] setPopUpFont:[UIFont fontWithName:kFontName size:25]];
[[TextFieldValidator appearance] setMandatoryInvalidMsg:@"This field is required"];
[[TextFieldValidator appearance] setPopUpCornerRadius:5.0f];
这就是全部了 - 现在就去设计一个 AETextFieldValidator 表单!