Bug: UITabBarController Title Text ignored in iOS 13.1

I found a bug recently in how iOS 13.1renders the UITabBarController. Here’s a description of the issue and a workaround.

Demo project: https://github.com/UberNick/TabBarLabelBug/

In a UITabBarController, the title text can be changed programmatically:

    [NSAttributedString.Key.foregroundColor: UIColor.green], 
    for: .selected)

In the above case, we set the selected title text to green. We can also use InterfaceBuilder to set the image tint color to red:

When the app starts up, it correctly shows the image as red and text as green.

The above screen is rendering the UITabBarButtonLabel correctly. Now, if we open and close an AVPlayerViewController window, the green label color is replaced with the red imageTint color:

This problem is easily reproducible on devices and simulators running iOS 13. The bug will not appear in iOS 12.

The bug is triggered by going to a full-screen AVPlayerController window. One weird aspect is that the tab currently selected isn’t affected by the display bug, but all the other tabs are. Trying to reset or reapply the textTitleAttribute has no effect.

The only workaround I’ve found so far is to make the imageTint color match up to the titleText color. But the bug was reported to Apple on 10/22/2019 and will hopefully be fixed in a future version of iOS 13.

Leave a Reply

Your email address will not be published. Required fields are marked *