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
Daniel Nakonieczny
Courses Plus Student 54,657 PointsImplementing Designs for iPhone -> Styling the navigation bar
I'm stuck on the code challenge "Styling the navigation bar" in the Implementing Designs for iPhone course (https://teamtreehouse.com/library/styling-the-navigation-bar). The instructions say: "Using the UINavigationBar's appearance proxy, set the background color of the navigation bars to [UIColor redColor]."
I use this line of code, which works in Xcode:
[[UINavigationBar appearance] setBackgroundColor:[UIColor redColor]];
but I get an exception in the Treehouse editor: "instance method '-setBackgroundColor:' not found (return type defaults to 'id')". Is this a bug?
3 Answers
Ben Jakuben
Treehouse TeacherSorry - that is a bug in the engine! I'll fix it. Did you run it in the Simulator to see how it looks? Using setBackgroundColor allows for the translucency effect to show, and if you want a solid color you need to use setBarTintColor. In the Challenge I wanted to use setBarTintColor (which is what it's checking for), but I should have made that clear or allowed setBackgroundColor. I will update it soon!
Daniel Nakonieczny
Courses Plus Student 54,657 PointsSounds good, thanks Ben!
Felix Guerrero
3,813 PointsI found the same issue, thanks to the forum post I could solve the challenge. It would be helpful update the challenge with the correct question.
Kal K
13,332 PointsKal K
13,332 Pointsfor some reason i use the setBarTintColor method and I'm still getting it wrong :( my code: [[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];