- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([textField isEqual:alcoholConsumptionTF] ) {
if (textField.text.length>=5) {
NSString *string = [textField.text substringToIndex:5];//截取范围内的字符串
textField.text=string;
return NO;
}
}
}
网友评论