我正在使用- (CGRect)firstRectForRange:(UITextRange *)range;来做这件事。然而,我不知道如何实际创建一个UITextRange。基本上这就是我要找的:
UITextRange*range2 = [UITextRange rangeWithNSRange:range]; //DOES NOT EX
我创建了一个自定义屏幕键盘,它不是inputView of the UITextField/* To accommodate text entry in documents that contain nested elements, or in whichUITextRange and UITextPosition are abstract
* classes
= textView.textRange(from: position, to: position)
问题是:
我无法将方法.closestPosition、.textRange和.offset转换为macOS,因为它们只在UIKit中可用,并且它们返回UITextPosition和UITextRange= textView.textRange(from: position, to