views:

322

answers:

2

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.

A: 

I was expecting some more answers for something as easy as it is :D

Anyway, any incomings welcome ;)

gotye
A: 

Seems as if the selected segment's tint color is made darker than original tint. Therefore if your tint is black then the selected segment's tint color doesn't change since there isn't anything darker than that.

I've looked around and haven't found any nice way to control the selected segment's tint color for this control.

Sebastian Bean