2014-05-17 35 views
0

我正在构建带有自定义TableCell's的TableView。并填充细胞的我解析一些jSON。问题是我可以在两个标签中显示文本,但出于某种原因,图像没有显示在ImageView中。自定义单元格中的UIImageView中没有图像

我TableCell.h类

@property (strong, nonatomic) IBOutlet UIImageView *cellImage; 
@property (strong, nonatomic) IBOutlet UILabel *storePhone; 
@property (strong, nonatomic) IBOutlet UILabel *storeAddress; 

我TableViewController.m类

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    TableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

    NSDictionary *tempDictionary= [self.storeArray objectAtIndex:indexPath.row]; 

    cell.storePhone.text = [tempDictionary objectForKey:@"phone"]; 
    cell.storeAddress.text = [tempDictionary objectForKey:@"address"]; 

    UIImage *storeImage = [UIImage imageNamed:[tempDictionary objectForKey:@"storeLogoURL"]]; 
    [cell.cellImage setImage:storeImage]; 

    return cell; 
} 

我也是用AFNetworking框架解析JSON。

回答

0

我能得到的图像通过使用下面的代码来显示:

NSData *imageData = [NSData dataWithContentsOfURL: [NSURL URLWithString: [tempDictionary objectForKey:@"storeLogoURL"]]]; 
[cell.cellImage setImage:[UIImage imageWithData: imageData]]; 
相关问题