0

I have 3 images, on switch background, off switch background and image for the round button in the switch. I need to implement a switch in ios6 with this design, so I need to change the width for this element and to change this three images. I try do make it this way:

self.optionSwitch.onImage = [UIImage imageNamed:@"switch_image_on"];
self.optionSwitch.offImage = [UIImage imageNamed:@"switch_image_off"];
CGRect switchRect = self.optionSwitch.frame;
switchRect.size.width = 40.0f;
self.optionSwitch.frame = switchRect;

but this code changed only the background for on and off state, I can't change the width of the whole element and the button style. How can I solve this? Thanks.

ShurupuS
  • 2,923
  • 2
  • 24
  • 44
  • This should help you. [UISwitch Back Image](http://stackoverflow.com/questions/16281735/custom-uiswitch-with-image) – Dunes Buggy Nov 13 '13 at 06:13

1 Answers1

1
[self.optionSwitch setTransform:CGAffineTransformMakeScale(1.50, 1.75)];

50% increase in width, 75% increase in length.