Reputation: 81
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
Upvotes: 1
Views: 2589
Reputation: 436
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(
Upvotes: 2
Reputation: 121
if let thumbView = try (mySwitch.subviews[0].subviews[3] as? UIImageView) {
thumbView.transform = CGAffineTransform(scaleX:1.5, y: 1.5)
}
Upvotes: 3
Reputation: 1081
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.
Upvotes: 1