Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Natacha S
11,561 Points[SOLVED] Another tricky one...changing button color in navigation bar
I am referring to this code challenge :http://teamtreehouse.com/library/styling-the-navigation-bar Here's the question : Now we want to change the color of the text of our navigation bar buttons to white. Use the appearance proxy to change the color using [UIColor whiteColor].
And now my code which needs to be debugged :
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Customize the nav bar
UIImage *backgroundImage = [UIImage imageNamed:@"navBarBackground"];
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
[[UINavigationBar appearance] setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setBarButtonItemColor:[UIColor whiteColor]];
return YES;
}
@end
2 Answers

Thomas Nilsen
14,957 Pointstry something like this:
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
[[UINavigationBar appearance] setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
EDIT As far as I can tell, the code I wrote is the same as you already have - but I took all 3 challenges now without problems
EDIT 2 It was very close but not entirely. Your last line ;)

Natacha S
11,561 PointsThanks ! I guess i tried something too complicated for the last question...I can't believe it was that easy ! Very subtle question !