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()
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
viewDidLoad:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.