Get Graphics Context Obj-C

Discussion in 'Mac Programming' started by Blakeasd, Sep 26, 2010.

  1. macrumors 6502a

    Joined:
    Dec 29, 2009
    #1
    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
    Code:
    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
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Code:
    CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
     
  3. thread starter macrumors 6502a

    Joined:
    Dec 29, 2009

Share This Page