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 trialMarie Veverka
12,117 PointsUITableViewCell with an Image Code Challenge
Hi There, I am not sure what I am doing wrong in this code challenge. Any ideas?
UITableViewCell *cell = [[UITableViewCell alloc] init];
/* Write your code below this line */
cell.imageView.image = [UIImage imageNamed:@"placeholder.png"];
Thanks!
3 Answers
Thomas Nilsen
14,957 Pointstechnically that is correct, but the challenge wants to use the image property you created in the first part of the challenge, so it should look like this:
UITableViewCell *cell = [[UITableViewCell alloc] init];
/* Write your code below this line */
UIImage *image = [UIImage imageNamed:@"placeholder.png"];
cell.imageView.image = image;
Stone Preston
42,016 Pointsyou got a bit ahead of yourself. all it asks you to do is create an instance of UIImage, not assign the image to the tableView cells image view (that happens in task 2)
all you need for task 1
UITableViewCell *cell = [[UITableViewCell alloc] init];
/* Write your code below this line */
UIImage *image = [UIImage imageNamed:@"placeholder.png"];
Marie Veverka
12,117 PointsThanks guys!