2

I have created a UISwitch in the Interface Builder. Its default size is 51x31

I have put constraints on it to make it smaller size 33x20

It shows smaller in the Interface Builder but on runtime it does not obey to the size constraints.

Elsewhere is it told that UISwitch is a special control and does not like to obey size constraints. Is it true?

Are there any workarounds?

milo526
  • 5,012
  • 5
  • 41
  • 60
Kashif
  • 4,642
  • 7
  • 44
  • 97

1 Answers1

0

As simple instead of creating a UISwitch , create UIButton and set background image as you want. Here set 2 background images for UIButton for 2 states. Just toggle the UIButton between these 2 states

Dhaiyur
  • 98
  • 9
AskIOS
  • 918
  • 7
  • 19