如何在 Xcode 界面构建器中更改默认色调颜色?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31795512/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:36:43  来源:igfitidea点击:

How to change default tint color in Xcode interface builder?

iosxcodeinterface-builder

提问by mindbomb

How does one change the global default tint color in Xcode interface builder?

如何更改 Xcode 界面构建器中的全局默认色调颜色?

enter image description here

在此处输入图片说明

回答by Marco Boschi

In the File inspectortab of the Utilitypanel, the right one, you can find controls about size classes, auto layout and the global tint of your storyboard.

在“实用工具”面板的“文件检查器”选项卡(右侧)中,您可以找到有关大小分类、自动布局和故事板全局色调的控件。

enter image description here

在此处输入图片说明

回答by joe g

Interface Builder Way: Select the Storyboard or Xib file you want to set the default tint on.

Interface Builder Way:选择要设置默认色调的 Storyboard 或 Xib 文件。

Then in Utilities on the first tab File Inspector look for the Interface Builder Document section and you will see a Global Tint like the image below shows.

然后在第一个选项卡 File Inspector 的 Utilities 中查找 Interface Builder Document 部分,您将看到如下图所示的 Global Tint。

(not enough reputation to post images)

(没有足够的声誉来发布图片)

enter image description here

在此处输入图片说明

Programmatically:

以编程方式

Obj-C:[[[[UIApplication sharedApplication] delegate] window] setTintColor:[UIColor orangeColor]];

对象-C:[[[[UIApplication sharedApplication] delegate] window] setTintColor:[UIColor orangeColor]];

Swift:UIWindow(frame: UIScreen.mainScreen().bounds).tintColor = UIColor.orangeColor()

迅速:UIWindow(frame: UIScreen.mainScreen().bounds).tintColor = UIColor.orangeColor()

回答by justdan0227

This does not appear to work if you turn on localization. The Global Tint dissapears

如果您打开本地化,这似乎不起作用。全局色调消失

回答by Vitaliy Gozhenko

You can set default tint color for whole window:

您可以为整个窗口设置默认色调:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window?.tintColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1)
        return true
}

回答by Adrian Sluyters

You can set the default appearance settings with:

您可以使用以下命令设置默认外观设置:

UIButton.appearance().tintColor = UIColor.orangeColor()

If you place it in:

如果你把它放在:

application:didFinishLaunchingWithOptions:

and only it'll apply application wide. Unless you change it lower down in the chain i.e. in UIViewController's

只有它会应用广泛。除非你在链中改变它,即在 UIViewController 中

viewDidLoad: