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?
views:
36answers:
1
+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
2010-09-26 19:04:53
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
2010-09-26 19:25:02
Excellent. Thanks!
hanno
2010-09-26 19:53:17
@Peter: Thanks-- hadn't stumbled across that table--very handy. Answer edited to be clear on this point.
quixoto
2010-09-27 00:58:17