UIWebView在每个cell中的内容都不同,在 tableView:cellForRowAtIndexPath: 中 alloc 的,然后需要在 heightForRowAtIndexPath: 中计算高度。
可是问题是,在创建这个cell之前没法知道UIWebView的高度呀,可是 heightForRowAtIndexPath 是需要在这之前提供高度的。也就说调用 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 会出错。
所以应该怎么办?如果在 heightForRowAtIndexPath 中 alloc 一个 UIWebView 再读取 htmlString 得到 height 这样速度会太慢了吧,而且会做两边同样的工作。。
求解。
可是问题是,在创建这个cell之前没法知道UIWebView的高度呀,可是 heightForRowAtIndexPath 是需要在这之前提供高度的。也就说调用 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 会出错。
所以应该怎么办?如果在 heightForRowAtIndexPath 中 alloc 一个 UIWebView 再读取 htmlString 得到 height 这样速度会太慢了吧,而且会做两边同样的工作。。
求解。