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
Michael Reining
10,101 PointsNext we need a UIImageView to display the pizza slice UIImage. Create a UIImageView variable and set its 'image' property to the UIImage variable you just created
I am stuck on this quiz. It' seems so simple but I am lost and confused.
Part 1 was really easy.
UIImage *image = [UIImage imageNamed:@"pizza_slice"];
The above is what I entered for the first part of the quiz.
Part 2 asks for the following:
Next we need a UIImageView to display the pizza slice UIImage. Create a UIImageView variable and set its 'image' property to the UIImage variable you just created.
3 Answers
Michael Reining
10,101 PointsI was finally able to figure it out. In part 2 it is asking you to alloc and initialize a UIImageView. Doh!
Stone Preston
42,016 PointsTo create an image view:
UIImageView *imageView = [[UIImageView alloc] init];
Then you can access the image property of that view using dot notation
imageView.propertyName = some value
Those hints should help you out
Edit: looks like you figured it out
Michael Reining
10,101 PointsThanks for the hint. I was able to solve this by using the initwithImage: method. Never thought of using the dot notation for this so thanks for that!