How to make the selected segment of UISegmentedControl darker?
I am using UIAppearance to set global styles for my iOS app. I represent light gray style.
[[UINavigationBar appearance]
setTintColor:[UIColor colorWithWhite:0.95 alpha 1.0]
];
[[UISegmentedControl appearance]
setTintColor:[UIColor colorWithWhite:0.90 alpha 1.0]
];
The problem is that the selected segment (Uno) of the UISegmentedControl is not much darker than the normal segment (Dos). The normal segment is already in the correct darkness, but I would only like to darken the selected segment so people can distinguish between the two. The darkening shade will darken both of them at the same time, so it won't work.
source to share
The easiest way to do this is to loop through the list of subzones for the segmented controller and see which one is selected, when you find the selected subview you will need to adjust its shade color darker.
for (int x= 0; x <[aSegementedController.subviews count]; x++)
{
UIBarButtonItem *subview = [aSegementedController.subviews objectAtIndex:x];
if ([subview isSelected])
{
[subview setTintColor:darkerColor];
}
}
This however does not work with UIAppearance, I do not believe it is configurable at this level.
source to share