I was trying to increase thumb size of a UISwitch
I was trying to increase thumb size by set on the image but the image is not showing.
I try this:
uiSwitch.onImage = UIImage(named: "sing")
i want switch like this
I was trying to increase thumb size of a UISwitch
I was trying to increase thumb size by set on the image but the image is not showing.
I try this:
uiSwitch.onImage = UIImage(named: "sing")
i want switch like this
if let thumbView = try (mySwitch.subviews[0].subviews[3] as? UIImageView) {
thumbView.transform = CGAffineTransform(scaleX:1.5, y: 1.5)
}
Create extension :
extension UISwitch {
func increaseThumb(){
if let thumb = self.subviews[0].subviews[1].subviews[2] as? UIImageView {
thumb.transform = CGAffineTransform(scaleX:1.5, y: 1.5)
}
}
}
Use:
customSwitch.increaseThumb(
If you want exactly as image you refered https://github.com/JunichiT/JTMaterialSwitch
If you want to increase the only the thumb size of the UISwitch itself, you can't. You must increase the size of UISwitch.