@@ -34,6 +34,8 @@ @interface TIoTRegisterViewController ()<UITextViewDelegate>
3434@property (nonatomic , copy ) NSString *conturyCode2;
3535
3636
37+ @property (nonatomic , strong ) UILabel *phoneTipLabel;
38+ @property (nonatomic , strong ) UILabel *emailTipLabel;
3739@end
3840
3941@implementation TIoTRegisterViewController
@@ -221,6 +223,26 @@ - (void)checkSendCode{
221223
222224-(void )changedTextField : (UITextField *)textField {
223225 [self checkSendCode ];
226+
227+ // 优化提示文案
228+ if (textField == self.phoneTF ) {// 手机号改密码
229+
230+ if ([NSString judgePhoneNumberLegal: textField.text]) { // 手机号合格
231+ self.phoneTipLabel .hidden = YES ;
232+ }else { // 手机号不合格
233+ self.phoneTipLabel .hidden = NO ;
234+ self.phoneTipLabel .text = @" 手机号格式不正确" ;
235+ }
236+
237+ }else { // 邮箱改密码
238+
239+ if ([NSString judgeEmailLegal: textField.text]) { // 邮箱合格
240+ self.emailTipLabel .hidden = YES ;
241+ }else { // 邮箱合格不合格
242+ self.emailTipLabel .hidden = NO ;
243+ self.emailTipLabel .text = @" 邮箱地址格式不正确" ;
244+ }
245+ }
224246}
225247
226248- (void )choseAreaCode : (id )sender {
@@ -354,6 +376,7 @@ - (UIScrollView *)scrollView{
354376 if (_scrollView == nil ) {
355377 _scrollView = [[UIScrollView alloc ] init ];
356378 _scrollView.backgroundColor = [UIColor whiteColor ];
379+ _scrollView.clipsToBounds = NO ;
357380 _scrollView.pagingEnabled = YES ;
358381 _scrollView.scrollEnabled = NO ;
359382 }
@@ -403,6 +426,17 @@ - (UIView *)contentView{
403426 make.height .mas_equalTo (48 );
404427 }];
405428
429+ self.phoneTipLabel = [[UILabel alloc ] init ];
430+ self.phoneTipLabel .font = [UIFont systemFontOfSize: 12 ];
431+ self.phoneTipLabel .text = @" 手机号格式不正确" ;
432+ self.phoneTipLabel .textColor = UIColor.redColor ;
433+ self.phoneTipLabel .hidden = YES ;
434+ [self .contentView addSubview: self .phoneTipLabel];
435+ [self .phoneTipLabel mas_makeConstraints: ^(MASConstraintMaker *make) {
436+ make.top .equalTo (self.phoneTF .mas_bottom ).offset (3 );
437+ make.leading .equalTo (self.phoneTF .mas_leading );
438+ }];
439+
406440 UIView *lineView = [[UIView alloc ] init ];
407441 lineView.backgroundColor = kLineColor ;
408442 [_contentView addSubview: lineView];
@@ -469,6 +503,18 @@ - (UIView *)contentView2
469503 make.height .mas_equalTo (48 );
470504 }];
471505
506+
507+ self.emailTipLabel = [[UILabel alloc ] init ];
508+ self.emailTipLabel .font = [UIFont systemFontOfSize: 12 ];
509+ self.emailTipLabel .text = @" 邮箱地址格式不正确" ;
510+ self.emailTipLabel .textColor = UIColor.redColor ;
511+ self.emailTipLabel .hidden = YES ;
512+ [self .contentView2 addSubview: self .emailTipLabel];
513+ [self .emailTipLabel mas_makeConstraints: ^(MASConstraintMaker *make) {
514+ make.top .equalTo (self.emailTF .mas_bottom ).offset (3 );
515+ make.leading .equalTo (self.emailTF .mas_leading );
516+ }];
517+
472518 UIView *lineView = [[UIView alloc ] init ];
473519 lineView.backgroundColor = kLineColor ;
474520 [_contentView2 addSubview: lineView];
0 commit comments