当鼠标在视图上按下时,以下代码绘制了一条额外的线。这似乎是由抗锯齿引起的。有没有人见过这个?
- (void) drawRect:(NSRect)dirtyRect
{
[[NSColor whiteColor] setFill];
NSRectFill(dirtyRect);
[[NSColor blueColor] setStroke];
NSBezierPath *path1 = [NSBezierPath bezierPath];
[path1 moveToPoint:NSMakePoint(0.00, 9.00)];
[path1 lineToPoint:NSMakePoint(300.00, 8.00)];
[path1 stroke];
[[NSColor redColor] setStroke];
NSBezierPath *path2 = [NSBezierPath bezierPath];
[path2 moveToPoint:NSMakePoint(184.00, 15.00)];
[path2 lineToPoint:NSMakePoint(8.00, 159.00)];
[path2 stroke];
}
- (void) mouseDown:(NSEvent *)theEvent
{
[super mouseDown:theEvent];
[self setNeedsDisplayInRect:CGRectMake(0, 0, 369, 15)];
}