相关疑难解决方法(0)

来自NSTextView中的字符的NSPoint/NSRect

因此,我试图获得与NSTextView中特定字符的位置相对应的NSPoint或NSRect.这就是我到目前为止所做的(效果不佳,结果似乎有些不可预测.

NSRange theTextRange = [[theTextView layoutManager] glyphRangeForCharacterRange:[theTextStorage editedRange] actualCharacterRange:NULL];
NSRect theTextRect = [[theTextView layoutManager] boundingRectForGlyphRange:theTextRange inTextContainer:[theTextView textContainer]];
Run Code Online (Sandbox Code Playgroud)

cocoa nstextview

3
推荐指数
1
解决办法
1385
查看次数

标签 统计

cocoa ×1

nstextview ×1