- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;
{
NSString * toBeString = [textField.text stringByReplacingCharactersInRange:range withString:string];
UITextField *loginPass = _textArr[1];
if (loginPass == textField) {
if ([toBeString length] > 12) {
textField.text = [toBeString substringToIndex:12];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"长度不能超过12" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
[alert show];
return NO;
}
}
return YES;
}