我想插入和图像到一个URL的UIImageView。我使用下面的代码来做到这一点。 运行程序时被卡住在从url下载图像到UIImageVIew动态
NSURL *url = [NSURL URLWithString:urlstring];
在下面的代码,它表明:在该特定的行“线程1信号SIGABRT”。 有人可以帮助我,并告诉如果我使用的格式是正确的或我做错了什么?
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"newoffer";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSDictionary *temp = [product objectAtIndex:indexPath.row];
UILabel *Label = (UILabel *)[cell viewWithTag:201];
Label.text = [temp objectForKey:@"item_name"];
UIImageView *Image = (UIImageView *)[cell viewWithTag:200];
NSString *urlstring=[temp objectForKey:@"image_url"];
NSURL *url = [NSURL URLWithString:urlstring];
NSData *data = [NSData dataWithContentsOfURL:url];
Image.image = [UIImage imageWithData:data];
return cell;
}
如果可能,请在此处张贴您的网址 –
如果在我的答案对您有帮助的情况下仍然面临任何问题,请将我的答案标记为正确。 –