修复了密码登录的无法输入很长

This commit is contained in:
fengshuo
2023-01-17 15:41:59 +08:00
parent 47a6fa5262
commit 5874beb3af
4 changed files with 8 additions and 3 deletions

View File

@@ -71,7 +71,7 @@
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisHorizontal;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentCenter;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 0;
}
return _stackView;
@@ -103,11 +103,11 @@
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
return textField.text.length <= 11;
return textField.text.length <= self.maxLength;
}
- (void)textFieldDidChangeSelection:(UITextField *)textField {
textField.text = [textField.text substringToIndex:MIN(textField.text.length, 11)];
textField.text = [textField.text substringToIndex:MIN(textField.text.length, self.maxLength)];
}
@end