Hi all,
Please use the below code if you want to change the color of UISegmentedControl's component after the selection of that rather showing the default color.
For example :
UISegmentedControl *segmentedControl; // You can use your own segmented control rather using this one...
UIColor *selectedColor = [UIColor colorWithRed: 0.0f/255.0 green:0.0f/255.0 blue:255.0f/255.0 alpha:1.0];
UIColor *deselectedColor = [UIColor colorWithRed: 0.0f/255.0 green: 0.0f/255.0 blue: 255.0/255.0 alpha:0.2];
for (id subview in [segmentedControl subviews]) {
if ([subview isSelected])
[subview setTintColor:selectedColor];
else
[subview setTintColor:deselectedColor];
}
Thanks,
Nilesh Prajapati
Please use the below code if you want to change the color of UISegmentedControl's component after the selection of that rather showing the default color.
For example :
UISegmentedControl *segmentedControl; // You can use your own segmented control rather using this one...
UIColor *selectedColor = [UIColor colorWithRed: 0.0f/255.0 green:0.0f/255.0 blue:255.0f/255.0 alpha:1.0];
UIColor *deselectedColor = [UIColor colorWithRed: 0.0f/255.0 green: 0.0f/255.0 blue: 255.0/255.0 alpha:0.2];
for (id subview in [segmentedControl subviews]) {
if ([subview isSelected])
[subview setTintColor:selectedColor];
else
[subview setTintColor:deselectedColor];
}
Thanks,
Nilesh Prajapati