PDA

View Full Version : Get Graphics Context Obj-C




Blakeasd
Sep 26, 2010, 12:45 PM
I am trying to get the Graphics Context from my Custom View and clear it. I know how to do it on the iPhone using CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextClearRect(ctx, rect);


I have been looking all over to find the equivalent to do this when programming for OS X. Does anyone know how to do this?

Thanks, Blake



kainjow
Sep 26, 2010, 12:53 PM
CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];

Blakeasd
Sep 26, 2010, 01:11 PM
Thanks!!
I feel stupid now :D