Hallo, ich habe ein Problem, mit CGContext ein Rechteck zu zeichnen. Was mache ich falsch? Hier die Klasse von meinem View:
Alles anzeigen
Quellcode
- - (void)drawRect:(NSRect)dirtyRect {
- [[NSColor whiteColor] set];
- NSRectFill(dirtyRect);
- NSGraphicsContext *currentNSGraphicsContext = [NSGraphicsContext currentContext];
- CGContextRef currentCGContextRef = (CGContextRef) [currentNSGraphicsContext graphicsPort];
- CGContextSetRGBStrokeColor(currentCGContextRef, 1, 1, 1, 1);
- CGContextSetRGBFillColor(currentCGContextRef, 0.1, 0.2, 0.3, 0.4);
- CGContextSetLineWidth(currentCGContextRef, 5);
- CGContextStrokeRect(currentCGContextRef, CGRectMake(10, 10, 100, 100));
- }