2
我有一个.plist引用.png文件的路径(键值=“maps”)。我能够将图像通过使用此代码,同时加载视图添加到一个数组:从.plist填充UIImageView
-(void)viewDidLoad {
NSString *path = [[NSBundle mainBundle] pathForResource:@"countries" ofType:@"plist"];
NSArray *countries = [NSArray arrayWithContentsOfFile:path];
NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"maps" ascending:NO] autorelease];
self.sortedCountries = [countries sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
}
我能够使用这种方法来添加图像TableViewCells:
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {}
我我试图做的是将这些相同的图像添加到新的ViewController中的UIImageView实例。我已经正确设置了ViewController,但是我怎样才能从UIImageView中显示图像,就像我为UITableViewCells做的那样?
数组没有`-objectForKey:`方法,更不用说`-ObjectForKey:`方法了。也许你的意思是`-objectAtIndex:`? – 2011-02-09 12:59:46