It looks like this whenever off:
While I'd prefer more of a grey background. Do I really have to use a UIImageView?
Here is how I changed the fill color of my iOS7 UISwitch.
First you need to import QuartzCore.
#import <QuartzCore/QuartzCore.h>
Then set the background color and round the UISwitch's corners.
UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0.0, 0.0, 51.0, 31.0)]; mySwitch.backgroundColor = [UIColor redColor]; mySwitch.layer.cornerRadius = 16.0; // you must import QuartzCore to do this. [self addSubview:mySwitch];
This will give you a UISwitch with a custom off (background) color.
Hope this helps someone:)
You can set the setOnTintColor
property of your UISwitch
to the color you desire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With