浏览代码

Merge pull request #288 from UnityTech/fixiostextfieldcrash

fix text field crash (merged from ConnectApp)
/main
GitHub 5 年前
当前提交
c5a65434
共有 1 个文件被更改,包括 5 次插入8 次删除
  1. 13
      Runtime/Plugins/platform/ios/UIWidgetsTextInputPlugin.mm

13
Runtime/Plugins/platform/ios/UIWidgetsTextInputPlugin.mm


[self.inputDelegate textWillChange:self];
[self.text setString:newText];
}
NSInteger composingBase = [state[@"composingBase"] intValue];
NSInteger composingExtent = [state[@"composingExtent"] intValue];
NSRange composingRange = [self clampSelection:NSMakeRange(MIN(composingBase, composingExtent), ABS(composingBase - composingExtent)) forText:self.text];
self.markedTextRange = composingRange.length > 0 ? [UIWidgetsTextRange rangeWithNSRange:composingRange] : nil;
NSInteger selectionBase = [state[@"selectionBase"] intValue];
NSInteger selectionExtent = [state[@"selectionExtent"] intValue];

_selectionAffinity = _kTextAffinityUpstream;
[self.inputDelegate selectionDidChange:self];
}
NSInteger composingBase = [state[@"composingBase"] intValue];
NSInteger composingExtent = [state[@"composingExtent"] intValue];
NSRange composingRange = [self clampSelection:NSMakeRange(MIN(composingBase, composingExtent),
ABS(composingBase - composingExtent))
forText:self.text];
self.markedTextRange =
composingRange.length > 0 ? [UIWidgetsTextRange rangeWithNSRange:composingRange] : nil;
if (textChanged) {
[self.inputDelegate textDidChange:self];

正在加载...
取消
保存