iOS 7 Views - Setting Tint Color

The tintColor property is used to render UI elements into the same color. In iOS7 the tintcolor property is part of UIView, which means the same tintColor will be applied trough the app. The tintcolor will be inherited from the parent view, unless explicitly set in the current view. In this tutorial we will show the effects of changing tintcolors.

Open Xcode and create a new Single View Application. For product name, use iOS7TintColorTutorial and then fill out the Organization Name, Company Identifier and Class Prefix fields with your customary values. Make sure only iPhone is selected in Devices.

Go to the Storyboard and select the main view. On the right hand side select the Attributes Inspector. As you can see the default tint colour is Blue.

Now drag two buttons to the main view, as you can see the default tint color of the text of these buttons is also blue. This is because the buttons tintcolor will be inherited from the parent view which is the main view.

Now change the tintColor of the bottom button in yellow.

Now change the tintcolor property of the main view in red. Build and Run the project, as you can see Button1 inherits the red color of the main view, but Button 2 is set explicitly to yellow.

You can download the source code of the iOS7TintColorTutorial at the ioscreator repository on github.