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.

iOS Build a Playlist Browser with Objective-C Working With Multiple View Controllers Recap of iOS Basics

Genevieve Tan
Genevieve Tan
4,257 Points

Unable to use UIColororangeColor


I keep getting an compiling error called Use of undeclared identifier 'UIColororangeColor"

I followed what paean typed in the video. Why is it not working for me ? :(

Please advise me on what i should do.

How do i access default colours such as red orange , blue, yellow etc.


This is my code :

self.view.backgroundColor = [UIColororangeColor] ;

2 Answers

Genevieve, I reviewed your code and it seems to me that your code does successfully change the background color to the default orange color.

self.view.backgroundColor = [UIColor orangeColor]; 

You can access all default colors with UIColor (redColor, grayColor). You can make custom colors with rgb values using UIColor's method shown here:

 self.view.backgroundColor = [UIColor colorWithRed:100 / 255.0 green:100 / 255.0 blue:100 / 255.0 alpha:1];

The above code will create a gray color. Since 255.0 is the greatest number for red, green and blue, you need to divide it by 255.0 to get a percent out of 1.

If you have any questions, feel free to ask!

Roberto Alicata
Roberto Alicata
Courses Plus Student 39,959 Points

You wrote [UIColororangeColor] instead of [UIColor orangeColor]