设置 xcode 项目的默认字体样式、颜色和大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10638954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set the default font style, color, and size for an xcode project
提问by Dan F
The app I'm working on has a particular color scheme, so I was wondering if it is possible to set a "default" background color, text color, and font size so that every time I create a new view, or label in Interface Builder I don't have to change all of these parameters.
我正在开发的应用程序有一个特定的配色方案,所以我想知道是否可以设置“默认”背景颜色、文本颜色和字体大小,以便每次在界面中创建新视图或标签时Builder 我不必更改所有这些参数。
回答by Dan F
As of iOS 5, there is the UIAppearance
protocol that all of the standard UI elements implement. Using the "Appearance proxy" you can set the appearance for ALL objects of that type in a given application. More information can be found in the incredibly helpful and informative WWDC '12 session on "Advanced Appearance Customization on iOS"
从 iOS 5 开始,UIAppearance
所有标准 UI 元素都实现了协议。使用“外观代理”,您可以为给定应用程序中该类型的所有对象设置外观。更多信息可以在关于“iOS上的高级外观自定义”的WWDC '12 会议中找到,非常有用和信息丰富
回答by Michael Dautermann
How about just creating a DanFViewController (subclassed from UIViewController) that already has the specific background color, text color, font size, etc. you need and then derive all your app's custom views from that?
如何创建一个已经具有特定背景颜色、文本颜色、字体大小等的 DanFViewController(UIViewController 的子类),然后从中派生所有应用程序的自定义视图?
That's what I do in my own apps where clients are expecting a certain look & feel for all the views.
这就是我在我自己的应用程序中所做的,客户希望所有视图都有一定的外观和感觉。