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

iOS Implementing Designs for iPhone Customizing Table View Controllers Styling the Navigation Bar

Stuck on code challenge 3:Now we want to change the color of the text of our navigation buttons to white color...

Link to Code Challenge: http://teamtreehouse.com/library/styling-the-navigation-bar

Code Challenge question 3 of 3: 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]. I am getting a compile error on any of the three solutions detailed below. Can someone pls. help?

Main Block:

#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];

Solution 1 - based on track video; result: did not work
    [[UINavigationBar appearance] setTextTitleAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,nil]];

Solution 2 - based on track notes; result: did not work
    [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil]];

 Solution 3 - based on post above: result: did not work
    [[UINavigationBar appearance]setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];

     return YES;
}

@end

1 Answer

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

The question says: "Now we want to change the color of the text of our navigation bar buttons to white." You need modify the button color as shown at the 8:00 minute mark in the video by modifying the tintColor.

Thanks, it works now.