[英]How to change default tint color in Xcode interface builder?
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) (没有足够的声誉来发布图片)
Programmatically :以编程方式:
Obj-C: [[[[UIApplication sharedApplication] delegate] window] setTintColor:[UIColor orangeColor]];
Obj-C:
[[[[UIApplication sharedApplication] delegate] window] setTintColor:[UIColor orangeColor]];
Swift: UIWindow(frame: UIScreen.mainScreen().bounds).tintColor = UIColor.orangeColor()
Swift:
UIWindow(frame: UIScreen.mainScreen().bounds).tintColor = UIColor.orangeColor()
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
}
This does not appear to work if you turn on localization.如果您打开本地化,这似乎不起作用。 The Global Tint dissapears
全局色调消失
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 ie in UIViewController's
除非您在链中更改它,即在 UIViewController 中
viewDidLoad:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.