Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当使用 NSRectFill 或 NSBezierPath.fillRect 在 NSTextView 中的某些文本上绘制块时,文本似乎越过了我的矩形。即只有一小块矩形从我应该覆盖的文本后面偷看。如何确保在绘制文本后绘制矩形?
如果你继承了 NSTextView。首先,用 super 绘制文本,然后绘制自己的东西。
- (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; NSRectFill(yourOwnRect); }