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?
I’m using this sniplet to center strings that are drawn with CoreGraphics. I can’t
Share
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.