Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Developer and personalized recommendations.Start Your Free Trial Now
- View Offline
- Working with automated configuration in Xcode
- Using asset catalogs
- Understanding color and space in the iOS 7 UI
- Adding and debugging Auto Layout constraints
- Adding background fetch support
Skill Level Intermediate
Well, some graphical elements like bar backgrounds have become de-emphasized. Color has become important than iOS 7 simply because we have removed a lot of other graphical onamentation. A good example is with basic buttons. Whether they are in the main body in your app or in the navigation bar. Buttons no longer have an outline, they're simple colored text or a straight forward simple line icon. But we used to have multiple graphical states for our buttons with different image backgrounds to show if something was being pressed or was active or inactive.
So now we do this through color instead, we can draw attention to whether a button is touchable or if it's worthy of special attention using color. As you probably noticed, the color is blue by default to indicate that something is touchable. And that's what I'd see in Mail. It's what I'd see in settings, or in photos and many other applications. But if I go into a context where there's something that I can't do, say I go into an empty folder, I'll find that the Edit button at the top right is going to get grayed out. That's the hint that this is not touchable.
And this will happen automatically, and it will happen a couple of different situations. If I go into an email that I'm working with and I hit the button to Reply or Forward. We're getting multiple visual suggestions here. Okay. First, we have the pretty normal action appearing with the gray overlay. Over the rest of our content. But if you notice there is more to it than that. The buttons underneath the overlay are not just being faded. The actual color of them has changed. We're not just seeing a darker blue. They've gone to gray again. It's a second level of information that those are untouchable.
They're on the action sheet itself, we're getting our click-able options in blue, although the Cancel one in a slightly heavier font. But that's not only option, if you've use iOS 7 for awhile, you will see some differences, it's not just blue. If you go into Calendar, you're going to see red. If you go into Notes, you'll see yellow, if you go into Game center, it's purple. And there's a consistency to them. It's not one button on one of the bars is red and the others are blue, it's all red. Same if I go into Notes, it's all yellow.
Text buttons at the top, line icons at the bottom. It's a subtle way of theming the application without other graphical information. You can do this yourself in your own applications by using the tintColor property. Now we had tintColor as a property for awhile in iOS, but it used to be on each individual control. Now in iOS 7 it's part of UIView. And the great thing about that, is it's hierarchical, so you don't need to change every single UI Control you're using. Because if you set it on a top level container view like the top window, all the sub-views will automatically pick up that tint color.
But this can be done through code, or it can be done an interface builder. So here, I just have a very straight forward master detail project that I've created. The, the typical project template. I've just added a couple of things to the detail view here about a tool bar with some icons on it, and just to prove the point here, I'm going to drag on a segmented control. And perhaps a button and a slider. These are all right now taking the default tint color, which is the default blue. But what you'll find wherever you are in interface builder, if you go to the normal file inspector for any of the view controllers.
You'll find an entry here for a global tint, currently set to default, but I could pick one of the suggested colors or just go to Other. And let's say here, we'll pick an orange. I can already see the impact that that's had on these items here. That just by setting it in one place, and effectively I've just set it on the window at the top level. That tint color has taken effect on the segmented controls, it's taken effect on the buttons, the sliders, and all the line icons that are embedded inside the toolbar. That tint color will dim by default when you do something like make an action sheet appear, but you can even tweak that behaviour.
There's a tintAdjustmentMode for control of that one. And there's even a tintColorDidChange method on UIView if you need to implement and react to that changing. Going back into the Notes application is one more color example to see. Although this app has had a tint color of yellow, which has taken effect on all the different buttons, whether they're on the tool bar or the top navigation bar. If we hit Delete for an existing note, we're going to get the fairly standard action sheet. And because action sheets often have to do potentially destructive behaviour, and action sheet does not take that tint color on.
And also, it will show any destructive button option in red, another subtle but useful hint for behaviour. But what I can also see here is that color is not our only hint. There's a difference in font weight, too, and that gets us to a few core things we need to understand about how iOS 7 manages text.