1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Drawing text in a custom view

Discussion in 'iPhone/iPad Programming' started by JohnGaby, Nov 16, 2009.

  1. macrumors newbie

    I am new to iPhone development (and to mac development in general). I am trying to figure out how to draw text in a custom view. I can use the function CGContextShowTextAtPoint to draw the text, but how do I get information about the text extent so I can center or right justify the string?

  2. Moderator


    Staff Member

    Why not just use a UILabel?
  3. macrumors newbie

    Thanks for the reply. I am aware of UILabel, but I would rather not have to create a label for each piece of text that I wish to display. I was hoping that there would be a mechanism where I could output the text directly to the device context.
  4. macrumors regular

  5. macrumors 68030



    Stay away from CG text drawing if at all possible. It's very complex.

Share This Page