Customize UITabBarItem appearance

Did anyone manage to successfully customize the new UITabBarItem appearance?


On old tvOS version I could set the tab bar item color using title text attributes on UITabBarItems directly. On tvOS 13 this still works partially... it changes the text color on items with normal state (though the system modifies this color). Focused & selected items can't be changed at all. I can change the selectionIndicatorTintColor... but without being able to change the text foreground color this is almost useless (e.g. image setting selectionIndicatorTintColor to black... without being able to set the text color to white the text is invislble).


My questions:

1.) Is there any way to use exact text colors in UITabBarItems while in normal state (without the system changing them).

2.) Is there any way to change the text colors in UITabBarItems while in selected/focused state (any at all??)

3.) How do you use the new UITabBarItemStateAppearance class? The normal/selected/disabled/focused properties are nil. They are readonly and can't be set. The initializers are unavailable which indicates that these properties should be non-null by default. Is this still work in progress (comming in a later seed) or am I missing something?

Replies

I found out how to change the color of the focused UITabBarItem. What they do is create an UIImage from the bar item text and overlay the image over the selection indicator. The UIImageView is set to UIImageRenderingModeAlwaysTemplate... which means it uses the UITabBars tintColor. If you need your selected item text to be white, just set the UITabBar tintColor to white.


Still no idea about the other question though...