UIContentSizeCategory UIContentSizeCategory Enum

Definition

An enumeration whose values specify the various dynamic type sizes that can be chosen by the application user.

[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public enum UIContentSizeCategory
type UIContentSizeCategory = 
Inheritance
UIContentSizeCategoryUIContentSizeCategory
Attributes

Fields

AccessibilityExtraExtraExtraLarge AccessibilityExtraExtraExtraLarge 12

A medium font reflecting the current accessibility settings.

AccessibilityExtraExtraLarge AccessibilityExtraExtraLarge 11

A medium font reflecting the current accessibility settings.

AccessibilityExtraLarge AccessibilityExtraLarge 10

A medium font reflecting the current accessibility settings.

AccessibilityLarge AccessibilityLarge 9

A medium font reflecting the current accessibility settings.

AccessibilityMedium AccessibilityMedium 8

A medium font reflecting the current accessibility settings.

ExtraExtraExtraLarge ExtraExtraExtraLarge 7

A font that's larger than ExtraExtraLarge.

ExtraExtraLarge ExtraExtraLarge 6

A font that's larger than ExtraLarge.

ExtraLarge ExtraLarge 5

An extra-large font.

ExtraSmall ExtraSmall 1

Quite small.

Large Large 4

A large font.

Medium Medium 3

A medium-sized font.

Small Small 2

A small font.

Unspecified Unspecified 0

Remarks

After the application user has set the "Text Size Property" in Settings, the application will receive a notification via ObserveContentSizeCategoryChanged. It is the application developer's responsibility, at that point, to invalidate the layout in all view elements that implement Dynamic Type. The simplest way to do that is to have a method that re-sets the font in all components that support Dynamic Type:


 UIApplication.Notifications.ObserveContentSizeCategoryChanged((s,e) => {
    SetDynamicTypeFonts();
});

//Call this when initializing, and also in response to ObserveContentSizeCategoryChanged notifications
private void SetDynamicTypeFonts()
{
    headlineLabel.Font = UIFont.PreferredFontForTextStyle(UIFontTextStyle.Headline);
    bodyText.Font = UIFont.PreferredFontForTextStyle(UIFontTextStyle.Body);
  //...etc...
}

Applies to