gpt4 book ai didi

Swift - 显示警报时图像颜色重置

转载 作者:可可西里 更新时间:2023-11-01 00:42:19 24 4
gpt4 key购买 nike

所以在我的 iOS 应用程序中,我有一个设计如下的菜单:

enter image description here

图像是使用以下代码创建的:

cell.imageCell?.image = menuItems[indexPath.row].image
cell.imageCell.image = cell.imageCell.image?.withRenderingMode(.alwaysTemplate)
cell.imageCell.tintColor = MenuTableViewController.fontColor
cell.imageCell.backgroundColor = UIColor.clear

这段代码放在tableview的cellForRowAt函数中。现在所有不同的 View Controller (HomeViewController、InfoViewController 等...)都无法访问菜单 Controller ,因此无法更改图像的颜色,我也无法在其他任何地方更改这些图像的颜色。现在,当我按下其中一个不使用任何警报或模态视图(如主页或信息)的选项卡时,图像保持完美,但是当我按下天气或短途旅行时,它会下载带有 URLSession dataTask 的 json 文件并显示警报提示请稍候,图像变成灰色,如下所示:

enter image description here

我不确定一个 View Controller 怎么可能更改另一个 View Controller 的 subview 。提前致谢-豪尔赫

最佳答案

也许您看到的是图标的暗淡显示。不要使用图像模板或将 tintAdjustmentMode 设置为 normal 来停止淡出图标。如果您显示警报或模态 Controller ,通常会发生这种情况。

关于Swift - 显示警报时图像颜色重置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42277593/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com