How to change default tint color in Xcode interface builder?

你说的曾经没有我的故事 提交于 2020-07-20 06:54:12

问题


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


回答1:


In the File inspector tab of the Utility panel, the right one, you can find controls about size classes, auto layout and the global tint of your storyboard.




回答2:


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

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.

(not enough reputation to post images)

Programmatically:

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

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




回答3:


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
}



回答4:


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




回答5:


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

viewDidLoad:


来源:https://stackoverflow.com/questions/31795512/how-to-change-default-tint-color-in-xcode-interface-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!