NSXMLParser を使用して XML ファイルを解析しています。セルの数は、XML ファイルのエントリ数によって異なります。これはすべてうまくいきます。
ここで、(XML ファイルで宣言された) URL をロードしたいプロトタイプ セルに UIImageView を追加しました。
ストーリーボード エラー: 接続をコンパイルできませんでした..
プロトタイプセルのせいだとわかっています。しかし、XML とは異なる画像を表示できるすべてのセルに UIImageView を追加するにはどうすればよいでしょうか?
編集:
Heres 私のコードですが、これは重要ではありません..Interface Builder で UIImageView を接続するたびに、エラーが表示されます..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"productCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
XMLProductView *listedProduct = [appDelegate.products objectAtIndex:indexPath.row];
/*
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] init];
[queue addOperation:operation];
*/
NSString *imageURL = listedProduct.image;
NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:imageURL]];
UIImage *image = [UIImage imageWithData:imageData];
[imageView setImage:image];
cell.textLabel.text = listedProduct.name;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}