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 Build a Blog Reader iPhone App Adapting Data for Display UITableViewCell with an Image

Matt Faber
Matt Faber
9,156 Points

Possible question glitch?

I answered the first task of the coding challenge with the following line of code and the answer registered as correct.

UIImage* image = [UIImage imageNamed:@"placeholder"];

However when I got to task 2 and kept entering the following code below.

cell.imageView.image = image;

I kept getting the error that my image file name was incorrect.

I then had to change my answer for Task 1 to the following in order for Task 2 to evaluate correctly.

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

I went and tested this in Xcode and found that you do not need to enter the file extension of the image name for the code to work in the iOS simulator.

Is it better practice to use file extensions using the convenience constructor imageNamed on UIImage, or is this an error in the questions answer evaluation?

1 Answer

Sam Chaudry
Sam Chaudry
25,519 Points

When building apps I usually include it!