Reputation: 2013
I've set default tint color in my storyboard, but I'm getting old blue, default color for my UISwitch component.
So I've tried to put
[[UIView appearance] setTintColor:APPCOLOR];
inside of my app delegate method
- (void)applicationWillResignActive:(UIApplication *)application
but still no luck, I also tried to put there
[[UISwitch appearance] setTintColor:APPCOLOR];
and again no change.
The APPCOLOR
is defined in my constants.h file which I of course include.
How I can set this tint color of my UISwitch globally?
The tint color of other elements, for example UIButton changes properly.
Upvotes: 24
Views: 9761
Reputation: 57060
The UISwitch
tint color controls the border color. If you want to set the on color, you need to use onTintColor
.
Read here the documentation of what these tint colors represent for UISwitch
.
Also, you should not be setting appearance in applicationWillResignActive:
delegate method. This is called when the application resigns active state. You should set appearance in application:didLaunchWithOptions:
.
Upvotes: 76