【发布时间】:2010-11-06 00:40:14
【问题描述】:
我正在通过 URL 动态地将不同大小的图像加载到我的 UITableViewCells 中。我希望能够根据下载的图像大小调整单元格的大小。我可以提取尺寸然后更改每个单元格的 heightForRowAtIndexPath 吗?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSData *receivedData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[arrayOfImages objectAtIndex:indexPath.row]]
options:NSUncachedRead
error: &error];
UIImage *image = [[UIImage alloc] initWithData:receivedData];
imgView.image = image;
[cell.contentView addSubview:imgView];
....
【问题讨论】:
标签: objective-c uitableview ios4 uiimage