I have an app with lots of iOS Switches and the customer wants to something else than the standard green when some switches are ON.
Changing the background (using declares) doesnt work, its a rectangle (square corners) behind the switch which also replaces the white color inside the switch when its OFF. When ON the green color
Changing TintColor doesnt work: affect the border color when switch is OFF and has no effect when switch ON.
Has anyone a solution to change this green color ?
Cherry on the cake would be to be able to specify a color for OFF state and another for ON.
Sub SetOnTintColorXC(extends s As iOSSwitch, value As Color)
'declare sub setTintColor lib "UIKit.framework" selector "setTintColor:" (id as ptr, UIColor as Ptr)
'setTintColor s.Handle, new UIColor(c)
Dim uic As UIKit.UIColor
If value.Alpha = 255 Then
uic = UIKit.UIColor.ClearColor
Else
uic = New UIColor(value)
End If
declare sub setOnTintColor lib "UIKit.framework" selector "setOnTintColor:" (id as ptr, UIColor as Ptr)
setOnTintColor(s.Handle, uic)
End Sub
you need the complete class/module to have UIColor and such but this is how it works.
@Dave S True but the cornerRadius is useful if you want to change the background color because the background is a rectangle by default. At least that is what I understood from the article I linked. I am no specialist.