Uitableview 自定义单元格内的UIImageView中没有图像
我正在使用自定义TableCell构建一个TableView。为了填充单元格的内容,我正在解析一些jSON。问题是我可以在两个标签中显示文本,但由于某些原因,图像没有显示在ImageView中 我的TableCell.h班Uitableview 自定义单元格内的UIImageView中没有图像,uitableview,uiimageview,tableview,Uitableview,Uiimageview,Tableview,我正在使用自定义TableCell构建一个TableView。为了填充单元格的内容,我正在解析一些jSON。问题是我可以在两个标签中显示文本,但由于某些原因,图像没有显示在ImageView中 我的TableCell.h班 @property (strong, nonatomic) IBOutlet UIImageView *cellImage; @property (strong, nonatomic) IBOutlet UILabel *storePhone; @property (stro
@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。我能够使用下面的代码获得要显示的图像:
NSData *imageData = [NSData dataWithContentsOfURL: [NSURL URLWithString: [tempDictionary objectForKey:@"storeLogoURL"]]];
[cell.cellImage setImage:[UIImage imageWithData: imageData]];