Xamarin.forms: iOS - UISwitch.Appearance.OnTintColor broken in 3.1.0.583944 update.

Created on 22 Jun 2018  ·  9Comments  ·  Source: xamarin/Xamarin.Forms

Description

The iOS setting UISwitch.Appearance.OnTintColor no longer works after the Xamarin.Forms 3.1.0.583944 update.

Steps to Reproduce

  1. Set UISwitch.Appearance.OnTintColor in the AppDelegage.cs FinishedLaunching method.
    (see https://docs.microsoft.com/en-au/xamarin/xamarin-forms/platform/ios/theme#uiswitch)

Expected Behavior

On iOS switches show the selected colour when in the On state.

Actual Behavior

Switches are shown with the default iOS green colour in the On state.

Basic Information

  • Version with issue: 3.1.0.583944
  • Last known good version: 3.0.0.561731
  • IDE: Visual Studio for Mac 7.5.3 (build 7)
2 regression iOS 🍎 bug

Most helpful comment

@philmoz you can easily create a style in your app.xaml to add color on all your switch:

<Style TargetType="Switch"> <Setter Property="OnColor" Value="yourcolor"/> </Style>

All 9 comments

Same bug here.
UITabBarItem.Appearance.SetTitleTextAttributes seems bugged too.

@philmoz If you could attach a reproduction, we'd appreciate it.

Reproduction zip file (in case you missed it ----> XF_3111.zip

Before 3.1.0.583944 update:
simulator screen shot - iphone se - 2018-06-25 at 08 26 43

After 3.1.0.583944 update:
simulator screen shot - iphone se - 2018-06-25 at 08 28 06

yes the UISwitch is now broke in latest xamarin forms update the switch color is changed to default color in iOS (green) how can we customize now to other color

@vyasaraj999 you can use the “oncolor ” property in xamarin forms switch

Is this ever going to get fixed or do I now have to manually add another property to every switch?

Instead of having one theme setting applied to all switches I now have to add a property to them all (and hope I don't miss one).

What happened to not breaking existing functionality?

@philmoz you can easily create a style in your app.xaml to add color on all your switch:

<Style TargetType="Switch"> <Setter Property="OnColor" Value="yourcolor"/> </Style>

@markjackmilian thanks.... it is working fine now.

Should be fixed on 3.3.0 as pr #3819 was merged alread

Was this page helpful?
0 / 5 - 0 ratings