问题
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