My iOS app's color theme is used to set the app's global tint colors
. However, in some cases this results in white text on a white background (which I would like to avoid). Is there a way that I could temporarily change my global tint color
(or set a specific tint color
for that instance)?
我的iOS应用程序的颜色主题是用来设置应用程序的全局色调。然而,在某些情况下,这会导致白色背景上出现白色文本(我希望避免这种情况)。是否有一种方法可以临时更改全局着色颜色(或者为该实例设置特定的着色颜色)?
The two tint colors
in particular that I would like to change within the app are:
我特别想在app中改变的两种色调是:
UINavigationBar.appearance().tintColor
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor
Specifically, I would like to change the tint color in a situation where I do not have direct access to the view (such as, when I use UIActivityViewController to share an article and the notes' dialog "cancel" and "save" buttons are white-on-white).
具体地说,我想在没有直接访问视图的情况下更改着色颜色(例如,当我使用UIActivityViewController来共享一篇文章时,notes' dialog ' cancel '和' save '按钮是白色对白色的)。
1 个解决方案
#1
1
Go through the following link to get a better understanding of tintColor.
通过下面的链接来更好地理解丁色。
https://www.captechconsulting.com/blogs/ios-7-tutorial-series-tint-color-and-easy-app-theming
https://www.captechconsulting.com/blogs/ios-7-tutorial-series-tint-color-and-easy-app-theming
You can override the global tint colors in a specific view controller for a specific component.
您可以覆盖特定组件的特定视图控制器中的全局色调。
For example if you set the global tint color for UIButton to blueColor, you can do this in your view controller to override the tintColor
例如,如果您将UIButton的全局色调颜色设置为blueColor,您可以在视图控制器中这样做,以覆盖tintColor。
myButton.tintColor = UIColor.blueColor()
#1
1
Go through the following link to get a better understanding of tintColor.
通过下面的链接来更好地理解丁色。
https://www.captechconsulting.com/blogs/ios-7-tutorial-series-tint-color-and-easy-app-theming
https://www.captechconsulting.com/blogs/ios-7-tutorial-series-tint-color-and-easy-app-theming
You can override the global tint colors in a specific view controller for a specific component.
您可以覆盖特定组件的特定视图控制器中的全局色调。
For example if you set the global tint color for UIButton to blueColor, you can do this in your view controller to override the tintColor
例如,如果您将UIButton的全局色调颜色设置为blueColor,您可以在视图控制器中这样做,以覆盖tintColor。
myButton.tintColor = UIColor.blueColor()