Drawing Text with Core Graphics
I need to draw centered text to a CGContext. I started with a Cocoa approach. I created a NSCell with the text and tried to draw it thus: NSGraphicsContext* newCtx = [NSGraphicsContext graphicsContextWithGraphicsPort:bitmapContext flipped:true]; [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:newCtx]; [pCell setFont:font]; [pCell drawWithFrame:rect inView:nil]; [NSGraphicsContext restoreGraphicsState]; But the CGBitmapContext doesn't seem to have the text rendered on it. Possibly because I have to pass nil for the inView: parameter. So I tried switching text