浏览代码

Merge pull request #386 from UnityTech/fix_ios_issue

Fix iOS issue.
/main
GitHub 5 年前
当前提交
f41d4c1b
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 8
      Runtime/Plugins/platform/ios/UIWidgetsTextInputPlugin.mm

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


- (UITextPosition*)positionFromPosition:(UITextPosition*)position offset:(NSInteger)offset {
NSUInteger offsetPosition = ((UIWidgetsTextPosition*)position).index;
NSInteger newLocation = (NSInteger)offsetPosition + offset;
if (newLocation < 0 || newLocation > (NSInteger)self.text.length) {
return nil;
}
if (offset >= 0) {
for (NSInteger i = 0; i < offset && offsetPosition < self.text.length; ++i)
offsetPosition = [self incrementOffsetPosition:offsetPosition];

NSUInteger selectionBase = ((UIWidgetsTextPosition*)_selectedTextRange.start).index;
NSUInteger selectionExtent = ((UIWidgetsTextPosition*)_selectedTextRange.end).index;
NSUInteger composingBase = 0;
NSUInteger composingExtent = 0;
NSUInteger composingBase = -1;
NSUInteger composingExtent = -1;
if (self.markedTextRange != nil) {
composingBase = ((UIWidgetsTextPosition*)self.markedTextRange.start).index;
composingExtent = ((UIWidgetsTextPosition*)self.markedTextRange.end).index;

正在加载...
取消
保存