aleksandar
aleksandar

Reputation: 27

Can't change the tint of segmented control

I have some problem with segmented control. I can't change the tint color, what ever color I set for the tint, segmented control is always gray as you can see on the picture. Below is the code I'm using, changing the color of the button works.

UIColor *newTintColor = [UIColor colorWithRed:(30.0f/255.0f) green:(98.0f/255.0f) blue:(134.0f/255.0f) alpha:1.0f];

[btnLogin setBackgroundColor:newTintColor];
[btnLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

[rememberMe setTintColor:newTintColor];

I forgot one thing, on application start segmented control has newTintColor, after login in application is displayed new view (split view), when user clicks on settings button, view for settings is displayed. Settings view has one segmented control for which I also can't change tint color (it is always gray) and logout button, if user clicks on logout button login view is displayed again and segmented control has gray tint instead of newTintColor.

enter image description here

Upvotes: 0

Views: 611

Answers (1)

matt
matt

Reputation: 535306

The gray color is a clue: it suggests that this view's tint adjustment mode has at some point been set to UIViewTintAdjustmentModeDimmed and then has never been set back to Automatic. See the docs on UIViewTintAdjustmentMode:

https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/doc/c_ref/UIViewTintAdjustmentMode

Upvotes: 3

Related Questions