if (textField == _phoneTF) { //支持删除 if (range.length == 1 && string.length == 0) { return YES; } else if (_phoneTF.text.length >= 11) { _phoneTF.text = [textField.text substringToIndex:11]; //提示:可以去掉 [NDHudView showText:@"联系方式不得超过11位!" animated:YES configParameter:^(NDHudView *config) { } duration:1.0 inView:[AppDelegate sharedInstance].window]; return NO; } else{ return YES; } }