views:

110

answers:

1

Hi Buddies,

I have created scroll view and set the Segmented control as subview. If i scroll the segments and it moves horizontally. I have set,

 segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;

I got an output like this,

Image-1

But i want to plain background with the segments like this, Image-2

So is it possible to create a segments with plain background. Please guide me and if it is not possible please give me some alternate suggestions.

Thanks in Advance.

Pugal

A: 

UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithArray:temp]];

[segment setFrame:CGRectMake(0, 0, width, 30.0)];

[segment setSegmentedControlStyle: UISegmentedControlStyleBar];

[segment setTintColor:[UIColor redColor]];

[segment setSelectedSegmentIndex:0];

if you set TintColor , your UISegmentedControl style have to be "UISegmentedControlStyleBar" other style will be not work!