首页 > 如何保证应用风格统一?

如何保证应用风格统一?

有没有办法从全局设置应用的风格?
各种控件的颜色,背景图等等

希望我描述的清楚


你需要有一個統一的風格,才能保證風格統一。

即便從概念上你描述得很清楚,但到解決問題時,這樣的泛泛是遠遠不夠的。
全局設置風格的方法,一定跟具體的統一風格有關。

不存在一個對任意統一風格有效的設置方法(它們之間可能會矛盾)。

當然如果你的統一風格確定了,設置方法也就確定了。
比如你只需要將 tint color 統一爲紅色,那麼:

Previously, this would have required many lines of color-setting code,
however in iOS 7 its as easy as setting the tint color of the main
UIView for this feature to change it and all of its subviews with one
line:

self.view.tintColor = [UIColor redColor];

https://www.captechconsulting.com/blog/steven-beyers/ios-7-tutorial-series-tint-color-and-easy-app-theming

即可。

但如果你想像 Google 那樣把 material design 帶到 iOS,那麼你需要一個框架,其它部分用框架開發。


是可以做到的。
https://developer.apple.com/videos/wwdc/2011/
Customizing the Appearance of UIKit Controls

With iOS 5, you can customize the look of your app controls using the new Appearance APIs. The new Appearance Proxy API allows you to efficiently apply a custom appearance to your views and controls, including built-in controls such navigation, tab, and toolbars. These customizations can be applied across your entire app or independently on a per-control basis.

【热门文章】
【热门文章】