Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS:canned';t编译连接:单元格中的UIImageView_Ios_Xcode_Uiimageview_Cell - Fatal编程技术网

iOS:canned';t编译连接:单元格中的UIImageView

iOS:canned';t编译连接:单元格中的UIImageView,ios,xcode,uiimageview,cell,Ios,Xcode,Uiimageview,Cell,我正在使用NSXMLParser解析XML文件。单元格的数量取决于XML文件有多少个条目。这一切都很好 现在,我在原型单元格中添加了一个UIImageView,我想在其中加载我的URL(在XML文件中声明) 我的故事板错误:无法编译连接.. 我知道这是因为原型电池。但是,如何将UIImageView添加到所有单元格中,在这些单元格中可以显示来自XML的不同图像 编辑: 这是我的密码,但这并不重要。。每次我在Interface Builder中连接UIImageView时,都会显示错误 - (UI

我正在使用NSXMLParser解析XML文件。单元格的数量取决于XML文件有多少个条目。这一切都很好

现在,我在原型单元格中添加了一个UIImageView,我想在其中加载我的URL(在XML文件中声明)

我的故事板错误:无法编译连接..

我知道这是因为原型电池。但是,如何将UIImageView添加到所有单元格中,在这些单元格中可以显示来自XML的不同图像

编辑:

这是我的密码,但这并不重要。。每次我在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;

}也许你的imageView是一个出口?它不应该连接到原型单元。您可以在程序中添加imageView:

 [cell addSubview:imageView];
或者在故事板中创建imageView并完成:

 [cell viewWithTag:theTagOfImageView];
编辑2

我认为这是你真正需要的。祝你好运


我添加了代码,但我认为这不会导致错误。您是否已将imageView添加到单元格?是,已连接。但当我断开它时,错误就消失了。我可以做我想做的,图像不会出现。谢谢你的回答。我两个都试过了,但都不管用。。我查看了一些关于SO的帖子,发现了以下内容:。但我不确定它是否有效。@AlexisW我认为它应该有效。因为我这样做没有问题。请仔细检查,然后输入您尝试过的代码:)好的,我尝试过这个代码:
UIImageView*imageView2=(UIImageView*)[cell-viewWithTag:1]
imageView2.image=image。“但是什么都不管用。”——“亚历克西斯,请在你的答案中加上一些代码,告诉我什么是“什么都不管用”?嗨,鲁,代码在里面吗?我的问题是:图像无法显示。