Search code examples
xcodeuitabbartvostvos9.1

UITabBar displays UITabBarItem image ignoring rendering mode AlwaysOriginal


With the release of tvOS 9.1 and Xcode 7.2, my UITabBarItem images are being displayed incorrectly. In my view controllers, I set the tabBarItem.image and tabBarItem.selectedImage with images using UIImageRenderingMode.AlwaysOriginal.

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)

    self.tabBarItem.image = UIImage(named: "myTabImage")?.imageWithRenderingMode(.AlwaysOriginal)
    self.tabBarItem.selectedImage = UIImage(named: "myTabImageSelected")?.imageWithRenderingMode(.AlwaysOriginal)
}

The selected image displays correctly, but the non-selected image displays as a template, that is, its color information is ignored.

Both images displayed correctly using the tvOS 9.0 SDK, but the non-selected image is displaying incorrectly in tvOS 9.1. To make matters worse, the non-selected images are being shown as black and the tab bar background is also black.

enter image description here

Here is the same code running on tvOS 9.0

enter image description here

I suspect this is a bug with tvOS 9.1, but has anyone found a workaround or see something that I am not doing correctly?


Solution

  • It appears to definitely be a bug in the UITabBarController implementation for tvOS 9.1. So I ended up writing my own replacement. While at it, I added support for more than 7 tab bar items, made it look nice on a black background, and included a search bar on one of the tabs (also on a black background). This solves many of the difficulties I faced trying to build my first tvOS app.

    Link to Github repository

    enter image description here