我正在构建一个 iOS 应用程序,允许用户选择配色方案。该应用程序基本上有一种我想更改的强调色,但它在整个应用程序中的标签、背景、按钮、表格中的内容等上使用...
解决冗长代码的最佳方法是什么?
我的第一个选择是在每个 UI 元素中手动编写代码(很长的路要走)。他们是更简单的方法吗?
我看到了这个问题,但答案似乎不适用于我的情况:Can I tag a UIColor?
最佳答案
听起来你想看看UIAppearance :
You can customize the appearance of instances of a class by sending appearance modification messages to the class’s appearance proxy.
For example, to modify the bar background tint color for all instances of UINavigationBar:
[[UINavigationBar appearance] setBarTintColor:myNavBarBackgroundColor];
一些评论here
关于ios - 使用动态颜色创建 UI 的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27736144/