Q: How do I measure the width of my text before drawing it with Core Graphics?A: First call CGContextGetTextPosition to find the current text position. Then, set the text drawing mode to kCGTextInvisible using CGContextSetTextDrawingMode and draw the text. Finally, call CGContextGetTextPosition again to determine the final text position. Take the difference between the starting and ending positions to find the width of your text. Document Revision HistoryDate | Notes |
---|
2007-08-02 | minor cleanup and made 'Not Recomended' | 2001-07-02 | Explains how to measure Core Graphics text. |
Posted: 2007-08-02
|