setTitleColor For UISegmentedControl?

Discussion in 'iOS Programming' started by Darkroom, Jul 21, 2009.

  1. Darkroom Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #1
    is this possible? i'd like the selected segment to have white text, while the non selected segments have gray text.

    there only appears setTitle:forSegmentAtIndex: in the docs,and writing the following doesn't work:

    Code:
    [self.mySegment setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    No, not with the UISegmentedControl's API. There are workarounds, though messy, such as using setImage:forSegmentAtIndex:
     
  3. Darkroom thread starter Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #3
    oh that's too bad, especially since i always though the selected segment should be the light blue instead of the dark blue (default without tint), or at least the non selected text should appear darker by default...

    setImage wouldn't work with localization, well... it could but... i think i'll stick to the all white text instead of creating 50 different images in Illustrator.
     

Share This Page