Commit 6faa0ef428cddcb265c32f993f0a9f443d038810
1 parent
055b10a2
云测bug修复
Showing
1 changed file
with
7 additions
and
2 deletions
CNLiveVideoClassifyKit/Classes/SearchView/View/CNWitnessSearchView.m
| ... | ... | @@ -43,15 +43,20 @@ |
| 43 | 43 | |
| 44 | 44 | #pragma mark - UITextFieldDelegate |
| 45 | 45 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ |
| 46 | - if (([textField.text isEqualToString:@""]&&[string isEqualToString:@" "]) ||textField.text.length > 20) { | |
| 46 | + if (([textField.text isEqualToString:@""]&&![string isNotBlank]) ||textField.text.length > 20) { | |
| 47 | 47 | return NO; |
| 48 | 48 | } |
| 49 | - if (string.length > 20) { | |
| 49 | + if (textField.text.length + string.length > 20) { | |
| 50 | 50 | [QMUITips showError:@"粘贴内容不能超过20个字符" inView:AppKeyWindow hideAfterDelay:2]; |
| 51 | 51 | return NO; |
| 52 | 52 | } |
| 53 | 53 | return YES; |
| 54 | 54 | } |
| 55 | +- (void)textFieldDidChangeSelection:(UITextField *)textField{ | |
| 56 | + if ([textField.text containsString:@" "]) { | |
| 57 | + textField.text = [textField.text stringByReplacingOccurrencesOfString:@" " withString:@""]; | |
| 58 | + } | |
| 59 | +} | |
| 55 | 60 | - (BOOL)textFieldShouldClear:(UITextField *)textField{ |
| 56 | 61 | !self.clearBlock?:self.clearBlock(); |
| 57 | 62 | return YES; | ... | ... |