I want to change the color of onTintColor in UISwitch to off. The switch is in table view mode, and the software switch is done.
[settingsSwitch setBackgroundColor:[UIColor whiteColor]]; [settingsSwitch setTintColor:[UIColor whiteColor]]; [settingsSwitch setThumbTintColor:[UIColor redColor]]; [settingsSwitch setOnTintColor:[UIColor colorWithRed:138/256.0 green:9/256.0 blue:18/256.0 alpha:1]];

This is the result that I get when I set the background color to white.

And without the background, I get a red color, which is the color of my cell.

and this is the result that I want, when the switch is on onTintColor, it should be dark red, and in the off state it should be white.
I tried to set the image on the switch using this line of code
[settingsSwitch setOnImage:[UIImage imageNamed:@"on.png"]]; [settingsSwitch setOffImage:[UIImage imageNamed:@"off.png"]];
But he does not change the image. I want to change the color of the switch off. Hope I explained my question clearly. Thanks for the help in advance.
source share