el-flor
el-flor

Reputation: 1476

iOS - Change UISwitch button color and resize it

I would like to change a UISwitch' button color - not the background color.

I know about "tintColor" and "onTintColor", they work very well.

enter image description here

This is the effect I would like to achieve though.

I have managed to change the background color to the desired color, but I'm not able to change the button itself. It's always white -- can I change its color? And is it possible to make the button smaller?

Upvotes: 0

Views: 546

Answers (1)

brandonscript
brandonscript

Reputation: 72995

There's no native colour tint controls for UISwitch. You'd need to either write your own or use something like SevenSwitch or MBSwitch to get the effect you're looking for.

Personally I prefer MBSwitch as it doesn't require the use of images, and as you can see, you get a similarly colored control to what you're asking for:

img

Upvotes: 1

Related Questions