iOS: code optimize,delete useless code
This commit is contained in:
parent
23a39f20fc
commit
d834336b3c
@ -228,13 +228,9 @@ - (BOOL)textViewShouldEndEditing:(UITextView *)textView {
|
|||||||
|
|
||||||
- (void)textViewDidChange:(UITextView *)textView {
|
- (void)textViewDidChange:(UITextView *)textView {
|
||||||
if (textView.markedTextRange) return;
|
if (textView.markedTextRange) return;
|
||||||
|
|
||||||
if (self.maxLength) {
|
if (self.maxLength) {
|
||||||
UITextRange *selectedRange = [textView markedTextRange];
|
textView.text = [self limitToHansMaxLength:self.maxLength.unsignedIntValue text:textView.text];
|
||||||
UITextPosition *pos = [textView positionFromPosition:selectedRange.start offset:0];
|
|
||||||
if (!pos) {
|
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user