iOS:fix emoji cause substring error
This commit is contained in:
parent
7828b24cd5
commit
cb9f377a90
@ -199,7 +199,8 @@ - (BOOL)textViewShouldEndEditing:(UITextView *)textView {
|
||||
- (void)textViewDidChange:(UITextView *)textView {
|
||||
if (self.maxLength) {
|
||||
if (textView.text.length > self.maxLength.unsignedIntValue) {
|
||||
textView.text = [textView.text substringToIndex:self.maxLength.unsignedIntValue];
|
||||
NSRange range = [textView.text rangeOfComposedCharacterSequencesForRange:NSMakeRange(0, self.maxLength.unsignedIntValue)];
|
||||
textView.text = [textView.text substringWithRange:range];
|
||||
}
|
||||
}
|
||||
if (self.onTextChange) {
|
||||
|
Reference in New Issue
Block a user