Dela via


Accessibility Scaling for Named Font Sizes on iOS

This iOS platform-specific disables accessibility scaling for named font sizes. It's consumed in XAML by setting the Application.EnableAccessibilityScalingForNamedFontSizes bindable property to false:

<Application ...
             xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
             ios:Application.EnableAccessibilityScalingForNamedFontSizes="false">
    ...
</Application>

Alternatively, it can be consumed from C# using the fluent API:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
...

Xamarin.Forms.Application.Current.On<iOS>().SetEnableAccessibilityScalingForNamedFontSizes(false);

The Application.On<iOS> method specifies that this platform-specific will only run on iOS. The Application.SetEnableAccessibilityScalingForNamedFontSizes method, in the Xamarin.Forms.PlatformConfiguration.iOSSpecific namespace, is used to disable named font sizes being scaled by the iOS accessibility settings. In addition, the Application.GetEnableAccessibilityScalingForNamedFontSizes method can be used to return whether named font sizes are scaled by iOS accessibility settings.