I'm working on a similar problem. My object contains a name, a description, and an image. I would like to load an image into a UIImageView based on what was selected in the table row from the previous view. How do I load that? I can get everything to display, but the image. The name of the row appears in the nav bar, the description appears in the UILabel, but the image does not appear in the UIImageView.
The array entries look like this:
Fruit *fruit1 = [[Fruit alloc] initWithName:@"banana" description:@"This is a banana" picture:@"banana.png"];
My view is populated like this:
[self.navigationController pushViewController:self.fruitView animated:YES];
//put fruit name in the nav bar
self.fruitView.title = [fruit name];
//put fruit description into the label on the view
[self.fruitView.fruitDescription setText:[fruit description]];
I tried all these and nothing works:
//put the image into the UIImageView
[self.fruitView setImage:[fruit picture]];
self.fruitView.picture = [fruit picture];
[self.fruitView.picture setImage:[fruit picture]];
self.fruitView.image = [fruit picture];
Please help. Thanks.
|