Quick Tip: Globally Changing iOS Tint Colour In Swift

One of the ways an app can be customised easily in iOS is to change its tint colour. This can be done for specific elements such as your navigation bar in your storyboard. However, this can also be changed globally for your entire application — here's how.

From Storyboard

Open up your Storyboard and click the File Inspector (that's the one with the little page icon in the Utilities pane. Here you'll find "Global Tint".

File Inspector

This will set the tint for your storyboard. Should you use more than one in your app you'll need to do it per storyboard.

Programatically

You can also set the tint for your entire app in code. In your application delegate, pop the following in your application(_:didFinishLaunchingWithOptions:)

window?.tintColor = UIColor.redColor()

Of course, you can change the UIColor to be whatever you want it to be. As every view inherits this property your tint will be applied globally. Even things like UIAlertView and the I-Bar in text fields will be effected.

Want to say "Hello"? Drop me an email, follow me on Twitter, or check out Cocoon (you totally should, we're doing some cool stuff over there).


About Stephen Radford

Software Engineer. I take a few photos when I'm not stuck behind a keyboard too.

Leicester, UK http://stephenradford.co.uk

Comments