I am building a TableView with custom TableCell's. And to populate the cell's I am parsing some jSON. The issue is I can display text in two label's, but for some reason the image isn't showing up in the ImageView.
My TableCell.h class
@property (strong, nonatomic) IBOutlet UIImageView *cellImage;
@property (strong, nonatomic) IBOutlet UILabel *storePhone;
@property (strong, nonatomic) IBOutlet UILabel *storeAddress;
My TableViewController.m class
- (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;
}
Also I am using the AFNetworking framework to parse the jSON.
I was able to get the image to show by using the code below:
NSData *imageData = [NSData dataWithContentsOfURL: [NSURL URLWithString: [tempDictionary objectForKey:@"storeLogoURL"]]];
[cell.cellImage setImage:[UIImage imageWithData: imageData]];