iosuiswitchtintcolor

How to set UISwitch border color?


My app has:

[[UIView appearance] setTintColor:[UIColor whiteColor]];

And here is what I have when on:

switch in on position

and off:

switch in off position

I need to make UISwitch border visible like in Settings.app:

Settings app


Solution

  • Your [[UIView appearance] setTintColor:[UIColor whiteColor]]; is interfering with the tint color of your switch. The command to set the tint color is self.mySwitch.tintColor = [UIColor grayColor]; which sets the color used to tint the outline of the switch when it is turned off.