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
J V
1,774 Pointsios code challenge Help!: Add and image to the instance of UITableViewCell named 'cell' with the previously created 'image' object.
MY code: UITableViewCell cell = [[UITableViewCell alloc] init]; / Write your code below this line */ UIImage *image= [UIImage imageNamed:@"placeholder.png"]; self= [self addImage:@"image"];
12 Answers
Amit Bijlani
Treehouse Guest TeacherDon't want to give away the answer so let me phrase as a fill in the blank:
UITableViewCell cell = [[UITableViewCell alloc] init];
// Write your code below this line
UIImage *image= [UIImage imageNamed:@"placeholder.png"];
// You need to use set the image to the imageView property of cell
cell.imageView._____ = ________;
Amit Bijlani
Treehouse Guest TeacherYou are close except that the image is already defined in the previous line so need not define it again.
Amit Bijlani
Treehouse Guest TeacherYou have to set the "image" object to the "cell" object as in the video at the 4:00 minute mark.
J V
1,774 PointsAfter hours of working on this problem, I finally solved it! It makes me want to learn more. I appreciate you not giving me the answer.
Thanks again
J V
1,774 PointsSorry I don't understand.
J V
1,774 PointsYes thank you. I don't want answers I just want tips. I'm going to watch the video again. Amit I enjoy your style of teaching. I hope to see more new videos from you!
J V
1,774 Pointscell.imageView.image= [UIImage imageNamed:@"placeholder.png"];
I feel like like I need to understand this better because I'm really struggling. I'm still getting it wrong.
Ryan sTEADMAN
1,600 PointsIm still not sure how to do this question. Can someone explain please.
thanks
Lucas Yamashita
3,606 PointsHey Ryan,
I think there is some bug on the code challenge, cause when you hit this to the first question it goes right :
UIImage *image = [UIImage imageNamed:@"placeholder"];
But when you hit this to the second question it says its incorrect:
cell.imageView.image =image;
So you have to put exactly this code to solve the problem:
UIImage *image = [UIImage imageNamed:@"placeholder.png"]; cell.imageView.image =image;
Don't know why but the lack of ".png" from the first answer makes the second answer incorrect.
Hope it could help you!
Ryan sTEADMAN
1,600 PointsThank you so much. That is so frustrating, i had that code hours ago but to have to put it on the same line ahhahhhhhhhhhhhhhh that was nuts!!!
Brett Kim
11,576 PointsI thought that .png wasn't needed for file names... :P I got kind of caught up on all that
tom barbour
3,865 PointsHad the same issue. @"placeholder" works for challenge 1, but you have to change this to @"placeholder.png" in order to pass challenge 2 :/
Amit Bijlani
Treehouse Guest TeacherSorry about that it should be fixed now.