【发布时间】:2010-02-11 10:51:10
【问题描述】:
我想在 NSTextView 中获取一个点的屏幕位置(NSPoint),这应该很简单,但结果总是有点偏离,X 是完美的,但 Y 似乎有所不同。
我尝试了以下代码的一些变体,但无法得到我想要的结果,是 NSClipView 搞砸了吗?
NSPoint p = [[self layoutManager] locationForGlyphAtIndex:r.location];
//NSPoint b= [self convertPoint:p toView:nil];
NSPoint screenlocation = [self convertPointToBase:p];
有什么想法吗?
干杯!
MT
【问题讨论】:
标签: cocoa layout nstextview glyph