我正在尝试通过 Storyboard更改 segmentControl
上的 tintColor
。但是,不幸的是,在我的 AppDelegate 中,我为我的应用程序中的所有 View 设置了默认的 tintColor
。
在 AppDelegate 中:
UIView.appearance().tintColor = .myCustomColor
这将始终覆盖我的所有其他更改。因此,例如,如果我通过 Storyboard或以编程方式在我的 segmentControl
上设置另一个 tintColor
,它不会有任何影响。是否可以在不删除我在 appDelegate 中的代码的情况下解决这个问题?
最佳答案
要设置全局色调颜色但仍允许在控件或 View 中使用不同的色调,只需设置:
window?.tintColor = .myCustomColor
在 AppDelegate
的 application(_:didFinishLaunchingWithOptions:)
函数中。
关于ios - 当为 appDelegate 中的所有 View 设置自定义 tintColor 时,更改特定 View 的色调颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53223596/