Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Lyric Abbott
35,595 Pointshelp please
Using the appearance variable, set the tint color property to white color.
i tried this:
UINavigationBar *appearance = [barTintColor = whiteColor];
didnt work
1 Answer
Chris Shaw
26,676 PointsHi Lyric,
What you currently have is invalid code as an equals symbol is illegal inside of the [] brackets, instead what you what to be doing is targeting the UINavigationBar directly, grabbing it's appearance property and then setting the tint colour using an UIColor object.
[[UINavigationBar appearance] setBarTintColor: [UIColor whiteColor]];
This is for iOS 7+ only, if you're working with iOS 6 or below you will need to use the below.
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// iOS <= 6
[[UINavigationBar appearance] setTintColor: [UIColor whiteColor]];
} else {
// iOS >= 7
[[UINavigationBar appearance] setBarTintColor: [UIColor whiteColor]];
}
Lyric Abbott
35,595 PointsLyric Abbott
35,595 Pointsits still not working heres the quiz: http://teamtreehouse.com/library/uiappearance-to-customize-the-navigation-bar
Chris Shaw
26,676 PointsChris Shaw
26,676 PointsAh, the quiz is slightly different so what you want to do is capture the appearance property of
UINavigationBarand then use it to set thetintColorproperty.