I want to change the color of onTintColor in the UISwitch for the off State. The switch is in tableview and switch is made programmatically.
[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 i get when i set the background color white.
And without background i get red color which is the color of my cell.
and this is the result i want, when switch is on the onTintColor should b dark red, and in off state it should be white.
i tried setting the image on switch with this line of code
[settingsSwitch setOnImage:[UIImage imageNamed:@"on.png"]];
[settingsSwitch setOffImage:[UIImage imageNamed:@"off.png"]];
But its not changing the images. i want to change the color of switch in off state. Hope i have explained my question clearly.thanks for helping in advance.