views:

36

answers:

1

I'm using this sniplet to center strings that are drawn with CoreGraphics. I can't find any documentation on the function CGContextGetTextDrawingMode(). It's obvious what it does, but is this a private API that I should avoid?

+2  A: 

The test is simple: if it ain't documented, it's private. Don't use it for App Store submissions.

That said, the absence of this particular API seems like an oversight, since CGContextSetTextDrawingMode() is available and public. To stay on the safe side, if you know what mode you want, just set it and use it. If you want to preserve the existing value like in the snippet you point to, you can do this by saving and restoring the state of the graphics context using CGContextSaveGState, etc.

quixoto
Yup—the text drawing mode is part of the gstate. http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_overview/dq_overview.html%23//apple_ref/doc/uid/TP30001066-CH202-TPXREF132
Peter Hosey
Excellent. Thanks!
hanno
@Peter: Thanks-- hadn't stumbled across that table--very handy. Answer edited to be clear on this point.
quixoto