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!

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