I'm trying to draw a few lines as individual NSBezierPath objects (I'm keeping them independant so that I can later do some core animation on them). I'm having issues getting the lines to appear, and I'm sure I'm missing something obvious. Here is my code for drawing my lineA:
It builds fine although I'm getting CGContext errors on the console when my custom view tries to load. Also, I'm not seeing my 3pt wide vertical black line. I suspect this has something to do with the background (or lack-thereof) but any help/direction you could provide would be greatly appreciated.
Code:
- (id) initWithFrame: (NSRect) rect
{
if (![super initWithFrame: rect])
return nil;
NSLog (@"drawing my custom view");
NSRect bounds = [self bounds];
//make the points
NSPoint point1 = NSMakePoint ((bounds.origin.x) + 100, (bounds.origin.y) + 200);
NSPoint point2 = NSMakePoint ((bounds.origin.x) + 100, (bounds.origin.y) + 50);
//create the lines
lineA = [[NSBezierPath alloc] init];
[lineA setLineWidth: 3.0];
[[NSColor blackColor] set];
[lineA moveToPoint: point1];
[lineA lineToPoint: point2];
[lineA stroke];
[self drawRect: rect];
return self;
}
It builds fine although I'm getting CGContext errors on the console when my custom view tries to load. Also, I'm not seeing my 3pt wide vertical black line. I suspect this has something to do with the background (or lack-thereof) but any help/direction you could provide would be greatly appreciated.