What does the "automatically adjusts font requires using a dynamic type text style" warning mean?

51,348

Solution 1

It seems to have been a bug in Xcode. This is what I did to fix it:

  1. Change the font in the label that showed the error, to a dynamic type, as suggested
  2. Select check box for "Automatically Adjusts Font"
  3. Build and run the project (the error disappears)
  4. Uncheck the "Automatically Adjusts Font" box
  5. Change the font back to the previous setting that caused the error
  6. Rebuild the project

The error is still gone.

Solution 2

  1. Open your storyboard as Source Code
  2. Search for key "adjustsFontForContentSizeCategory"
  3. Check which object has this option and uncheck Dynamic Type checkbox from interface builder.

Solution 3

I just changed Text style to Body & Warning vanishes.

It's Just because it is dynamic type textStyle

See list of predefined supported dynamic type textStyle -

enter image description here

Solution 4

I had the same problem. Even after I opened the storyboard as source and removed the "adjustsFontForContentSizeCategory" key, saved and cleaned the project it would still show.

So then I:

  1. Cleaned the project
  2. Closed Xcode
  3. Deleted the derived data folder contents
  4. Re-Opened Xcode and rebuilt

It was gone. :)

Solution 5

If the "Automatically adjusts font" box is checked with a non dynamic font this warning will appear. Either uncheck the box on the offending label or use a dynamic font type.

enter image description here

Share:
51,348
K. Law
Author by

K. Law

Updated on November 25, 2021

Comments

  • K. Law
    K. Law over 2 years

    I am getting the following warning:

    "automatically adjusts font requires using a dynamic type text style"

    Screenshot added

    Which I can not get rid of the warning is on main.storyboard.

    I have checked every UILabel in the Identity Inspector to make sure the "Automatically Adjusts Font" is unchecked.

  • Josh
    Josh almost 7 years
    I agree. Double and triple checked my files and even checked XML/source - it was not there yet XCode insists it is (even after a "clean"). How annoying.
  • Chris Prince
    Chris Prince almost 7 years
    In my case, I have this warning, but the adjustsFontForContentSizeCategory key doesn't appear in the Source Code.
  • Chris Prince
    Chris Prince almost 7 years
    In my case, this box is unchecked, but I am getting the warning.
  • Chris Prince
    Chris Prince almost 7 years
    I changed the font in the label that showed the error, to a dynamic type,-- I can't see any option that looks like it would be a dynamic type in the fonts. Suggestions?
  • K. Law
    K. Law almost 7 years
    I am now using the system font. I was using a custom font in some of the labels, which caused the problem. If you google dynamic fonts in Xcode, you may be able to find a list of other fonts which are dynamic. A little research goes a long way. Good luck.
  • user664939
    user664939 over 6 years
    How can you determine if your font is "non-dynamic"?
  • Shah Nilay
    Shah Nilay over 6 years
    @user664939 Non-dynamic fonts are able to change family and style. Dynamic fonts are not able to change family and style. It will get default as per size. you can set family and style from storyboard -> attribute inspector -> font.
  • leanne
    leanne over 6 years
    @user664939: instead of selecting a specific font, you select a font "type". Click the boxed "T" in the Font dropdown. In the window that opens, click the arrows to the right of that Font dropdown. Choose a "Text Style" from the list at the bottom. See the HIG's Visual Design, Typography section for info on point sizes, etc, related to each text style.
  • eemrah
    eemrah about 6 years
    Hi @K.Law thanks for answer but Xcode generate several same warning and all of the views are in the Intro.storyboard. When I clicked warning, Xcode just show the Storyboard not a spesific item.
  • Mojo66
    Mojo66 about 6 years
    Step 1: press ⇧⌥⌘K to clean the project and derived data. Omit step 3.
  • Yaro
    Yaro almost 6 years
    hmmm, ⇧⌥⌘K cleans the build folder inside the app's derivedData. But it does not deletes the whole derivedData folder. Is that enough? Or we do the usual "xCode Voodoo Dance" as described above :D
  • danomatika
    danomatika over 5 years
    Voodoo Dance worked for me. I had the same issue and for deprecated Push Segues as well. I manually changed every segue and label but warnings did not go away. Removing the DerivedData folder fixed it.
  • btrballin
    btrballin about 5 years
    Changing it to body seems to make it lose the ability to be bolded text.
  • DrWhat
    DrWhat over 4 years
    In my Xcode (11.1), there is no "Automatically adjusts font" box. I tried everything else, nothing worked, except this - with 0 votes. Thx
  • garafajon
    garafajon over 4 years
    I think it works now (Xcode 11) to just click on the warning and it selects the offending label. (So you can avoid the source code steps)
  • ScottyBlades
    ScottyBlades about 4 years
    @ChrisPrince, did you wind up solving that?
  • dbDev
    dbDev about 3 years
    This is the correct answer and should be marked as such.
  • Marlhex
    Marlhex almost 3 years
    The adjustsFontForContentSizeCategory are for UITextField issues and adjustsFontSizeToFit for UILabel issues