1

Go to "Settings"-> "General"-> "Accessibility"-> "Larger Text" to change the font size. Open my app, now all the UILabels and UIButtons do change accordingly. I want to disable it and want to keep as it is regardless of the large font or small font on the setting. I have made everything programmatically. How can I disable this?

xeb
  • 191
  • 1
  • 4
  • 12
  • Possible duplicate of this https://stackoverflow.com/questions/55971292/enable-disable-font-scaling-impact-by-ios-on-my-application – BlackPearl12 Apr 29 '20 at 12:01
  • 1
    1st I am not using storyboards. 2nd. I am unable to DISABLE it not enable that. – xeb Apr 30 '20 at 04:07

1 Answers1

0

myLabel.adjustsFontForContentSizeCategory = false

Although this depends on the font that you're using. See more info here: https://developer.apple.com/documentation/uikit/uicontentsizecategoryadjusting/1771731-adjustsfontforcontentsizecategor?language=objc.

Specifically, this part:

For this property to take effect, the element’s font must be vended one of the following ways:

  • It must be vended using the preferredFontForTextStyle: or preferredFontForTextStyle:compatibleWithTraitCollection: method with a valid text style.

  • It must be vended using one of the scaling methods from UIFontMetrics.

johnny
  • 1,434
  • 1
  • 15
  • 26