UISegmentedControl tint color on touch

Posted by gotye on Stack Overflow See other posts from Stack Overflow or by gotye
Published on 2010-04-10T11:57:21Z Indexed on 2010/04/10 12:03 UTC
Read the original article Hit count: 566

Hey everyone,

I have a UISegmentedControl in my app (see code below) :

// --------------- SETTING NAVIGATION BAR RIGHT BUTTONS
NSArray *segControlItems = [NSArray arrayWithObjects:[UIImage imageNamed:@"up.png"],[UIImage imageNamed:@"down.png"], nil];
segControl = [[UISegmentedControl alloc] initWithItems:segControlItems];
segControl.segmentedControlStyle = UISegmentedControlStyleBar;
segControl.momentary = YES;
segControl.frame = CGRectMake(25.0, 7, 65.0, 30.0);
segControl.tintColor = [UIColor blackColor];
[segControl addTarget:self action:@selector(segAction:) forControlEvents:UIControlEventValueChanged];

if (current == 0) [segControl setEnabled:NO forSegmentAtIndex:0];
if (current == ([news count]-1)) [segControl setEnabled:NO forSegmentAtIndex:1];
// ---------------

But I can't make it to show something when you click on it ...

It functionnally works perfectly but I would like it to tint to gray when you click on it (but just when you click) ... would that be possible ?

Thank you,

Gotye.

© Stack Overflow or respective owner

Related posts about uisegmentedcontrol

Related posts about color