0

我的表格视图单元格 (TTTAbleViewCells) 单元格包含从互联网异步加载的图像。加载图像时,表格视图单元格从 TTImageView 对象获取回调。

问题是在回调点我如何要求父 TTTableView 更改单元格的高度并相应地调整大小。

似乎对 heightForRowAtIndexPath 的调用仅在 tableview 绘图的开头。

4

2 回答 2

0

我不认为这是可能的。我建议调整您的图像大小以适合您的单元格,而不是反之亦然

于 2011-05-17T20:21:17.193 回答
0

我想我会在这里回答我自己的问题。

- (void)imageView:(TTImageView*)imageView didLoadImage:(UIImage*)image
{
    [self setNeedsLayout];
    NSIndexPath *indexPath = [(UITableView *)self.superview indexPathForCell:self];
    if(indexPath!=nil)
    {   
        NSArray* path = [NSArray arrayWithObject:indexPath];
        [(UITableView*)[self superview] reloadRowsAtIndexPaths:path withRowAnimation:UITableViewRowAnimationNone];
    }   
}
于 2011-06-04T00:55:51.980 回答