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

Otto Wichmann
Otto Wichmann
4,827 Points

Add an image to the instance [...]

"Add an image to the instance of UITableViewCell named 'cell' with the previously created 'image' object."

Thats the task at hand. Im on the "UITableViewCell with an image" challenge from "Adapting Data for Display"

I've tried a lot of different code, I even search for some tutorials over at stackoverflow. But I honestly just don't know what to do. I was able to solve the first part of the challenge with this line of code:

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

And I understood why I had to write that line. But when it comes to adding the 'image' object to 'cell' I'm just lost.

Thank you in advance for any help!

Cheers

1 Answer

David Kaneshiro Jr.
David Kaneshiro Jr.
29,247 Points

Otto Wichmann,

This task is asking you to assign the image object to the imageView.image property of the UITableView cell object.

For example:

someCell.imageView.image = someImageObject;
Otto Wichmann
Otto Wichmann
4,827 Points

-___-

I can't believe it was that easy.

I wrote that line of code before but I was adding (@"") to image

cell.imageView.image = @"image";

Thank you David Kaneshiro Jr.