UISegmentedControl图像在iOS 13上始终为黑色

时间:2019-10-11 07:30:40

标签: ios swift uisegmentedcontrol ios13

我正在使用带有图像的UISegmentedControl。我正在尝试使用模板图像和tintColor,selectedSegmentTintColor和backgroundColor都具有不同的颜色,因此所有颜色都应该可见,但是图像始终为黑色。示例如下:http://github.com/tomspee/SegmentedControl13

有什么办法可以修复UISegmentedControl上的黑色图像?

这就是我现在在iOS 13上获得的内容:

enter image description here

这是我在iOS 12中所拥有的,并且也希望在iOS 13上获得它: enter image description here

要添加:我已经实现了下一个代码以选择退出黑暗模式:

<key>UIUserInterfaceStyle</key>
<string>Light</string>

2 个答案:

答案 0 :(得分:1)

转到资源文件夹中的“图像设置”,然后在“渲染为”选项下将图像设置为“原始图像”。

答案 1 :(得分:-1)

看到有两个原因在iOS 13中始终显示黑色。有了iOS 13,我们也有了黑色主题。如果您想限制黑色主题。您可以使用以下代码。

<key>UIUserInterfaceStyle</key>
<string>Light</string>