Я использую этот код для загрузки изображения в мой UITableView.
Но ничего не загружается, есть идеи, почему? Ссылка верна, когда я ее вижу.
NSString *temp = [appointmentDictionaryTemp objectForKey:@"patient_small_photo_url"];
NSData * imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:temp]];
UIImage * image = [UIImage imageWithData:imageData];
UIImageView * myImageView = [[UIImageView alloc] initWithImage:image];
cell.patientImage = myImageView;
Обновление:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"appointmentCell";
AppointmentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NSDictionary *appointmentDictionaryTemp = [self.appointmentArray objectAtIndex:indexPath.row];
cell.patientNameLabel.text = [appointmentDictionaryTemp objectForKey:@"patient"];
cell.appointmentTimeLabel.text = [appointmentDictionaryTemp objectForKey:@"scheduled_time"];
NSString *urlString = [[appointmentDictionaryTemp objectForKey:@"patient_small_photo_url"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSData * imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
UIImage * image = [UIImage imageWithData:imageData];
cell.patientImage.image = image;
return cell;
}