Skip to content

Commit f62b4c2

Browse files
committed
补充遗漏的输入框提示文案
Change-Id: Id4ee9bdece8794a8cdea1ae04cb34833d6d668f9
1 parent dd5133a commit f62b4c2

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Source/LinkApp/Classes/Module/Login/Controller/TIoTRegisterViewController.m

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)