iOS: code optimize,delete useless code

This commit is contained in:
pengfei.zhou 2021-06-08 18:20:37 +08:00 committed by osborn
parent 23a39f20fc
commit d834336b3c

View File

@ -230,12 +230,8 @@ - (void)textViewDidChange:(UITextView *)textView {
if (textView.markedTextRange) return; if (textView.markedTextRange) return;
if (self.maxLength) { if (self.maxLength) {
UITextRange *selectedRange = [textView markedTextRange];
UITextPosition *pos = [textView positionFromPosition:selectedRange.start offset:0];
if (!pos) {
textView.text = [self limitToHansMaxLength:self.maxLength.unsignedIntValue text:textView.text]; textView.text = [self limitToHansMaxLength:self.maxLength.unsignedIntValue text:textView.text];
} }
}
if (self.onTextChange) { if (self.onTextChange) {
self.onTextChange(textView.text, self); self.onTextChange(textView.text, self);
} }