简体   繁体   English

如何在iOS中将所有视图设置为深色并将所有文本设置为白色?

[英]How to set all views to a dark color and all text to white in iOS?

I'm using Xcode 6. 我正在使用Xcode 6。

My app ist by default all white background and black text, text that is present in the title of the nav bar, the table views content, and the tab bar for example. 默认情况下,我的应用程序使用所有白色背景和黑色文本,例如导航栏标题中存在的文本,表格查看内容以及标签栏。 I would like that all my views (the tab bar and nav bar too) to be dark gray and hence all the text previously mentioned to be white. 我希望所有视图(选项卡栏和导航栏)都为深灰色,因此前面提到的所有文本均为白色。

Should I set it up for each view of my numerous view controllers, or there is a way to set it up for all the views of the app ? 我应该为众多视图控制器的每个视图设置它,还是可以为应用程序的所有视图设置它?

Thanks for the advice and help 感谢您的建议和帮助

在此处输入图片说明

The right way would be to set it up everywhere manually yourself. 正确的方法是自己在任何地方手动设置。 Because it will be helpful for people in the future to see what you are doing and where. 因为这对将来的人们查看您在做什么和在哪里有帮助。

Another way, which is equally correct would be to create your own customUIViews which would by default channge their colors to grey, and customUITextField which will turn their text white and same goes for labels. 另一种同样正确的方法是创建自己的customUIViews(默认情况下,将其颜色更改为灰色)和customUITextField(将其文本变为白色,并且将标签同样更改)。

Or use Categories on top of the existing classes of UI, and create a function setUpColor/setupFontColor, and call that function everwhere you want. 或在UI的现有类之上使用类别,并创建一个函数setUpColor / setupFontColor,然后在所需的任何位置调用该函数。 (I would personally go with the very first solution.) (我个人会选择第一个解决方案。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM