Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font Size Disabling - Xamarin iOS

How could the font size be disabled is a Xamarin.iOS app/code? I had done this in Xamarin.Android app using the following code:

private void initFontScale()
{
    Configuration configuration = Resources.Configuration;
    configuration.FontScale = (float)1.45;
    //0.85 small, 1 standard, 1.15 big,1.3 more bigger ,1.45 supper big 
    DisplayMetrics metrics = new DisplayMetrics();
    WindowManager.DefaultDisplay.GetMetrics(metrics);
    metrics.ScaledDensity = configuration.FontScale * metrics.Density;
    BaseContext.Resources.UpdateConfiguration(configuration, metrics);
}

What would be the equivalent of doing this in an iOS Xamarin app? Any help would be greatly appreciated.

like image 861
user268397 Avatar asked Sep 16 '25 02:09

user268397


1 Answers

Use this in your App code behind before you initialise your pages:

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

You'll need to include these:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
like image 91
Full English Avatar answered Sep 17 '25 18:09

Full English