Can you change the color of the placeholder text in UITextField?

Discussion in 'iPhone/iPad Programming' started by fenrus110, Jan 5, 2009.

  1. macrumors regular

    Joined:
    Mar 24, 2008
    #1
    I'm wanting to change the text color for the placeholder (it's using the default light grey). Is this even possible?
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    It should be possible if you override the drawPlaceholderInRect: method.
     
  3. 5et
    macrumors newbie

    Joined:
    Jul 31, 2008
    #3
    I add to my class
    But I don't know how I can change color here.
    Please. help me :(

    Code:
    
    @implementation UITextField (reverse)
    
    - (void)drawPlaceholderInRect:(CGRect)rect{
       //What I must add here?
       [super drawRect:rect];
    }
    
    @end
    
     

Share This Page