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

Change Color of Button

Hi Guys, Can't seem to get past this code challenge. Not sure what's wrong... 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].

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

My Code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    UIImage *backgroundImage = [UIImage imageNamed:@"navBarBackground"];
    [[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor, nil]];

return YES;
}

Thanks!

Any ideas Amit Bijlani Ben Jakuben

1 Answer

Rashii Henry
Rashii Henry
16,433 Points

Right before your return, go ahead and use the appearance proxy again on UINavigationBar. use the setTintColor: method to change the color.

Rashii Henry
Rashii Henry
16,433 Points

remove all of that titleTextAttributes stuff too, it has nothing to do with the questions.

hint: sometimes you have to think outside of the box versus copying from the video.

Thanks!