以下代码在视图上按下鼠标时绘制了一条额外的行。这似乎是抗原造成的。有没有人见过这个?
- (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)];
}