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

uiimage view

Add the UIImageView as a subview to the instance of UIView named 'catView'.

1.

2.

3./* Write your code below this line */

4.UIImage *image = [UIImage imageNamed:@"lolcat.png"];

  1. UIImageView *imageView = [ [UIImageView alloc] initWithImage:image];

  2. [self.view addSubview:'catView'];

i can't figure this one out! for line 6. i tried everything

3 Answers

John Wheal
John Wheal
27,969 Points

I'll warn you that I haven't watched any of the iOS videos. You are adding 'catView' as the subview but you have put it in quotation marks and haven't declared it.

I guess it should say: [self.view addSubview:imageView];

that does not work.