3 Replies
      Latest reply on Oct 14, 2019 6:22 AM by InstantInteractive
      InstantInteractive Level 1 Level 1 (0 points)

        For all my apps that use table view cells, I set up the textLabel and detailTextLabel in the storyboard editor to have a font of 'Body'.  And, as my minimum OS is iOS 11, I also check the 'Automatically Ajusts Font' checkbox.

         

        When building these apps with Xcode 10.3 against the iOS 12 SDK, the apps react to dynamic type changes automatically as expected.

         

        But, when building the same apps with Xcode 11 (release version) against the iOS 13 SDK, the apps no longer work.  All labels in table view cells have a fixed size.  Even when the app is launched with various settings of the system's text size already set up.

         

        Standalone labels though work a-ok (same font and automatically... settings used).

         

        If I inspect the label's attributes at runtime, they do indeed have the 'adjustsFontForContentSizeCategory' set to 'true'.  The font property appears "OK":

         

        - some : <UICTFont: 0x7f96d5c20440> font-family: "UICTFontTextStyleBody";
        font-weight: normal; font-style: normal; font-size: 17.00pt

         

        To remedy this, I created a sublass of UITableViewCell and in its awakeFromNib, I programatically set the font:

         

        let theFont = UIFont.preferredFont(forTextStyle: .body)
        textLabel?.font = theFont
        detailTextLabel?.font = theFont

         

        If I inspect the attributes with this workaround, the adjustsFontForContentSizeCategory is still set to 'true' (so matches what I set in IB).  The font property with dynamic text set to the default value is:

         

        - some : <UICTFont: 0x7fb78dd198a0> font-family: "UICTFontTextStyleBody";
        font-weight: normal; font-style: normal; font-size: 17.00pt
        

         

        Other than the memory address difference, they are identical.  Yet the behavior isn't the same.  So there must be something behind the scenes that isn't being set up correctly when just relying on the settings in IB.

         

        NOTE: While I didn't try all fonts, the same issue doesn't happen with 'Callout'.  I'll file a bug after I test all the other fonts to see if this is perhaps just isolated to 'Body'.