Make UISwitch accessible

UISwitch is not accessible, it's marked by the accessible inspector like it hasn't got the minimum 44x44 size. (It has 51x31)

How can i resize switch to make it accessible?

Note: A transform not are going fix it

Thanks for all.

Replies

A solution is to subclass UISwitch.

Code Block
@IBDesignable
class LargeSwitch: UISwitch {
@IBInspectable var scale : CGFloat = 1.2
override func draw(_ rect: CGRect) {
self.transform = CGAffineTransform(scaleX: scale, y: scale)
}
}


You will find some more details here:
https://developer.apple.com/forums/thread/658572
Hi @Claude31. If you make a transform, the Acccessibility Inspector marks that it's the same rect. So, this not solved the issue

I think UISwitch only is intended to be used as accessoryView in UITableViewCells. If you do that, you get the full height of the as touch area. Otherwise, use a UIButton.