Я собираюсь добавить изображения (через строку URL) в табличное представление. Однако фотоизображения не отображаются в таблице. Ниже приведен мой код для этого.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectZero];
imageView.tag = kImageValueTag;
[cell.contentView addSubview:imageView];
[imageView release];
}
// Configure the cell...
NSUInteger row = [indexPath row];
Photo *thisPhoto = [self.thisArray objectAtIndex:row];
UIImageView *thisImageView = (UIImageView *)[cell.contentView viewWithTag:kImageValueTag];
NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: thisPhoto.imageURL]];
NSLog(@"URL: %@",thisPhoto.imageURL);
thisImageView.image = [UIImage imageWithData:imageData];
return cell;
}
Все мои изображения имеют разные размеры. Как сделать так, чтобы в таблице отображались изображения в зависимости от их размеров?