本文介绍了在Xcode 11(测试版2)的Interface Builder中指定了条形颜色时,UITabBarItem图标未针对iOS 13正确着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Xcode 11,beta 2在iOS 13模拟器上运行时,我的UITabBarItems的颜色存在问题. .但是,当我通过Interface Builder指定自定义的条形颜色时,会得到以下提示:

I have a problem with the color of my UITabBarItems when I run on iOS 13 simulators, using Xcode 11, beta 2. I have made a sample project from scratch, and everything works correctly when I do not specify a bar tint color. However, when I do specify a custom bar tint color via Interface Builder, I get this:

如果我将Interface Builder中的"Bar Tint"属性设置为除clear以外的任何选项,则选项卡栏中的所有项目图标均具有选定的颜色.设置为清除时,图标将正确着色.如果我在iOS 12模拟器中编译并运行,图标的颜色也会正确显示.

All items icons in the tab bar have the selected color if I set the "Bar Tint" property in Interface Builder to anything but clear. When it is set to clear, the icons are colored properly. The icons are also colored properly if I compile and run in an iOS 12 simulator.

这似乎是Xcode 11中的错误,但也许我遗漏了一些东西?

This seems like a bug in Xcode 11, but maybe I'm missing something?

推荐答案

从表面上看,这似乎是一个错误,但是您可以通过在UITabBar实例上定义一个.unselectedItemTintColor来缓解它.

On the surface, this might seem like a bug, however you can mitigate it by defining an .unselectedItemTintColor on your UITabBar instance.

self.tabBar.unselectedItemTintColor = [UIColor lightGrayColor];

这篇关于在Xcode 11(测试版2)的Interface Builder中指定了条形颜色时,UITabBarItem图标未针对iOS 13正确着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 06:57