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

    #1
    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?

    Thanks
     
  2. Moderator

    dejo

    Staff Member

    #2
    Why not just use a UILabel?
     
  3. macrumors newbie

    #3
    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

    #4
    UITextView?
     
  5. macrumors 68030

    PhoneyDeveloper

    #5
    UIStringDrawing.h

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

Share This Page