Changing UISwitch border
00:05switch.layer.borderWidth = 1.0; switch.layer.cornerRadius = 16.0; switch.layer.borderColor = [UIColor whiteColor].CGColor;
[self.mySwitch setThumbTintColor:[UIColor blueColor]]; [self.mySwitch setOnTintColor:[UIColor redColor]];
ie. Use setOnTintColor for the background/border color.// s is a UISwitch s.layer.borderWidth = 1 s.layer.borderColor = UIColor.whiteColor().CGColor s.layer.cornerRadius = 16
// you must import QuartzCore to do this.switch.tintColor = [UIColor redColor]; // the "off" color switch.onTintColor = [UIColor greenColor]; // the "on" color
0 nhận xét