Is there an API call to adjust the height of an iOS Switch?
The default height is 31 and I would really like to make it smaller, but Xojo doesnt allow it
According to my findings on Stackoverflow, you need to “transform” the Switch to change its scale.
Declare sub transform lib "UIKit" selector "setTransform:" (obj_id as ptr, matrix as CGAffineTransformStruct)
Dim scale As CGAffineTransformStruct
Declare function CGAffineTransformMakeScale lib "CoreGraphics" (sx as CGFloat, sy as CGFloat) as CGAffineTransformStruct
scale = CGAffineTransformMakeScale(0.8, 0.8)
transform(switch1.handle, scale)
And the CGAffineTransformStruct:
Structure CGAffineTransformStruct
a as CGFloat
b as CGFloat
c as CGFloat
d as CGFloat
tx as CGFloat
ty as CGFloat
End Structure
5 Likes
Thanks Jeremie.
I love (not) the names they give these functions.
They just aren’t discoverable.
I could end my life without getting a stab at CGAffineTransformMakeScale
I wonder - was ‘ChangeSize’ on a sabbatical when they were inventing this stuff?
1 Like