I am using UISwitch
in iOS 3 to make a switch element in my app. It has default color set to blue, but I want to change its color to brown.
How can I choose a different color for the UISwitch
element in iOS 3?
How can I choose a different color for the UISwitch
element in a modern iOS app (iOS 5+)?
Finally, with iOS 5 you can change the color of the switch with the property onTintColor
.
UISwitch *s = [[UISwitch alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
s.on = YES;
s.onTintColor = [UIColor redColor];
[self.view addSubview:s];
[s release];
produces this: