I have an NSTextView and require the coordinates of the insertion point to display a view there upon user interaction.
There is a function to get the character index from an NSPoint. I am wondering if there is any easy way to do the opposite?
Thanks for any help!
当然: [textView firstRectForCharacterRange:[textView selectedRange]];
You might be able to do it with an NSTextView subclass, overriding -drawInsertionPointInRect:color:turnedOn:
to cache the drawing rect and using the center of the rect (or some other interior point).
NB: I haven't tried this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.