NSView に 2 つの要素を持つ単純な bezierPath があります。押されたボタンの最後の要素 (NSPoint) を変更したいのですが、私のコードではパスに視覚的な効果がありません。ここで NSView サブクラスの私のコード:
NSBezierPath *path;
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(0, 0)];
[path lineToPoint:NSMakePoint(60, 60)];
[path setLineWith:2.0];
[[NSColor redColor] set];
[path stroke];
//the path is correctly drawing and visible
}
- (IBAction)buttonPressed:(id)sender {
NSPoint newPoint = NSMakePoint(120, 120);
[path setAssociatedPoints:&newPoint atIndex:1]; //has no visible effect
}
なにか提案を ?