131

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.

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
K. Law
  • 2,541
  • 3
  • 18
  • 27
  • 1
    I suspect "automatically adjusts font requires using a dynamic type text style", probably to adjust it dynamically. – shallowThought May 03 '17 at 17:37
  • 13
    You want to use a dynamic font ("Body", "Headline", "Subhead"), OR more likely, turn off `Automatically Adjusts Font` and turn on `Autoshrink`. – bshirley Jul 27 '17 at 17:14
  • How do you understand which of the dozens of storyboards and then of the dozens of labels, is causing the issue when the warning is NOT clickable? – jalone Jun 16 '21 at 10:08

9 Answers9

63
  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.
ayalcin
  • 877
  • 1
  • 8
  • 16
44

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

Jack
  • 13,571
  • 6
  • 76
  • 98
32

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. :)

shim
  • 9,289
  • 12
  • 69
  • 108
Spilly
  • 1,069
  • 2
  • 9
  • 16
  • 4
    Step 1: press ⇧⌥⌘K to clean the project and derived data. Omit step 3. – Mojo66 Apr 12 '18 at 11:25
  • 1
    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 – Yaro May 13 '18 at 13:18
  • 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. – danomatika Dec 07 '18 at 11:00
29

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.

shim
  • 9,289
  • 12
  • 69
  • 108
K. Law
  • 2,541
  • 3
  • 18
  • 27
  • 2
    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. – Josh May 24 '17 at 19:14
  • 4
    `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? – Chris Prince Jun 16 '17 at 17:56
  • 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. – K. Law Jun 19 '17 at 13:30
  • 3
    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. – eemrah Mar 02 '18 at 12:19
20

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

Donovan King
  • 855
  • 1
  • 6
  • 18
  • 3
    In my case, this box is unchecked, but I am getting the warning. – Chris Prince Jun 16 '17 at 17:49
  • 21
    How can you determine if your font is "non-dynamic"? – user664939 Aug 10 '17 at 12:36
  • 1
    @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. – Shah Nilay Aug 29 '17 at 05:54
  • 6
    @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](https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/) for info on point sizes, etc, related to each text style. – leanne Nov 10 '17 at 21:11
18
  1. Open your storyboard, right click storyboard in file navigator.

enter image description here

  1. Search for (command F) and delete instances of adjustsFontForContentSizeCategory="YES"
ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
  • 1
    In my Xcode (11.1), there is no "Automatically adjusts font" box. I tried everything else, nothing worked, except this - with 0 votes. Thx – DrWhat Oct 23 '19 at 19:40
  • The adjustsFontForContentSizeCategory are for UITextField issues and adjustsFontSizeToFit for UILabel issues – Marlhex Jul 13 '21 at 23:05
5

In the Storyboard, after uncheck every "Automatically Adjusts Font" in the Attributes Inspector, run shift + command + K and then build your project again. This should clean your project and remove the warning.

Arkamer
  • 51
  • 1
  • 3
4

Swift 5+, Xcode 11+:

  1. Right-Click the storyboard that's having this issue (Check Issue Navigator if you don't know which)

  2. Go to the Open As option and select Source Code

  3. Replace every adjustsFontSizeToFit="NO" with adjustsFontSizeToFit="YES"

  4. Run your application

  5. Watch the warning go away (And even if you undo step 3)

Gerardo B.
  • 71
  • 4
1

I got this error for automatic adjusting on a button. But I could not find "Automatic Adjust Font" checkbox on right panel. Get rid of warning by going to source code of .storyboard and deleting "adjustsFontForContentSizeCategory" properties on problematic button solved my problem.

Yunus Gedik
  • 53
  • 1
  • 9