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
Josh Benard
3,919 PointsCode Challenge: Styling the NavBar Section 1
Using the UINavigationBar's appearance proxy, set the background color of the navigation bars to [UIColor redColor].
Heres my code:
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Customize the nav bar
UIImage *backgroundImage = [UIImage imageNamed:@"navBarBackground"];
[[UINavigationBar appearance] setBackgroundColor:[UIColor redColor]];
return YES;
}
@end
3 Answers
Patrick Cooney
12,216 PointssetTintColor rather than setBackgroundColor should do it.
Josh Benard
3,919 PointsNope, that gives the error: "Make sure you are calling the correct method"
Josh Benard
3,919 PointsIt appears that the correct answer is using the method "setBarTinitColor:(UIColor)"
However, since either method does the same thing, that doesn't make a whole lot of sense to me
Patrick Cooney
12,216 PointsSorry, was trying to do it from memory. I was partly right! Ha.