I have a simple bezierPath with 2 elements in a NSView; I want to modify the last element (NSPoint) on a button pressed but my code don't have any visual effect on the path. Here my code in NSView subclass:
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
}
any suggestion ?