UITableViewCell custom labels -- color when selected

Discussion in 'iPhone/iPad Programming' started by xinevil, Apr 19, 2009.

  1. macrumors newbie

    Joined:
    Jul 12, 2008
    #1
    Hi,

    I have a custom UITableViewCell with two UILabels in it. When I select the tableCell, I want the UILabels textColor to be white, until the selection is done (with [tableView deselectRowAtIndexPath:indexPath animated:YES]).
    All of Apples custom cells do the same (look at settings app, contacts app, etc.).
    I had a kind-of-solution: use -(void)setSelected:(BOOL)selected animated:(BOOL)animated;
    But the problem is the label gets white too late (the cell will become black as soon as you touch it, but the labels will become white as soon as you let go the touch).
    Also: where do I make the labels textColor black again, so that it animates from white to black precisely as the cell animates from blue to white?
     
  2. macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #2
    Are you talking about the label in a cell turning to white when the background is blue?

    If that's the case then you'd use:

    PHP:
    [label setHighlightedTextColor:[UIColor whiteColor]];
     
  3. thread starter macrumors newbie

    Joined:
    Jul 12, 2008
    #3
    Nice thanks :D.
    Sometimes it can be sooooo easy :p .
     

Share This Page