ios – Color in UISwitch track


I have a UISwitch to which I am customising the thumb and track color.

if (locationTrackingSwitch.On)
    locationTrackingSwitch.ThumbTintColor = FromHEX(theme.colorInput);
else
    locationTrackingSwitch.ThumbTintColor = FromHEX(theme.colorButton);
locationTrackingSwitch.Layer.CornerRadius = (nfloat)(locationTrackingSwitch.Frame.Height / 2.0);
locationTrackingSwitch.BackgroundColor = UIColor.Black; //FromHEX(theme.colorInput);
locationTrackingSwitch.OnTintColor = FromHEX(theme.colorButton);

If the background color is Black, it shows black in the track like in pic Black-Background

But if the background color is white as in

locationTrackingSwitch.BackgroundColor = UIColor.White; 
//FromHEX(theme.colorInput);` 

It shows gray colour track instead of white as in

White-Background.

I am not understanding why the white color is not visible. It works fine with any other color. Also, the same white color shows fine with the thumb in the “On” state.
(theme.ColorInput is white color, “#ffffff”)

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img