开发者

Pass a UImage to a UIImageView

I am trying to pass an image loaded from a UIImage instance to a UIImageView in a DetailViewController. I can see I am getting pulling he ima开发者_Python百科ge path successfully, and accessing the .gif file as seen in my NSLogs () :

2011-02-09 10:52:13.404 WorldGovernments[31443:207] pathToMap = af-map.gif
2011-02-09 10:52:13.406 WorldGovernments[31443:207] detail map is: <UIImage: 0x4e44a80>

I am uncertain on how to pass this image to MapDetailsViewController in the following method?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

MapDetailsViewController *dvController = [[MapDetailsViewController alloc] initWithNibName:@"MapDetailsView" bundle:[NSBundle mainBundle]];

NSDictionary* tempDict=[sortedCountries objectAtIndex:indexPath.row];

NSString *pathToMap = [tempDict objectForKey:@"map"];

NSLog(@"pathToMap = %@",pathToMap);

UIImage *detailMap = [UIImage imageNamed:pathToMap];

NSLog(@"detail map is: %@",detailMap);

MapDetailsViewController.selectedImageView.image = detailMap;

[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
//dvController = nil;


}

I know I am doing something horribly wrong in this line :

MapDetailsViewController.selectedImageView.image = detailMap;

Since I get this error when I build:

Request for member 'image' in something not a structure or union


change

MapDetailsViewController.selectedImageView.image = detailMap;

to

dvController.selectedImageView.image = detailMap;


MapDetailsViewController.selectedImageView should be dvController.selectedImageView.image = detailMap;.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜