Ios UITableView自定大小单元格滚动问题,单元格高度差异较大

Ios UITableView自定大小单元格滚动问题,单元格高度差异较大,ios,swift,uitableview,ios8,uitableviewautomaticdimension,Ios,Swift,Uitableview,Ios8,Uitableviewautomaticdimension,每个单元格的高度相差200-400,因此尝试在estimatedHeightForRowAtIndexPath中执行高度计算。由于计算的bcz,我无法准确估计此方法中的高度 在willDisplayCell方法中缓存高度,但滚动仍会跳跃,就像渲染需要时间一样 该单元格类似于Facebook卡片类型的布局,包含大量具有可变高度文本和图像的动态数据。是否有人可以帮助我解决此问题。谢谢如果您能够计算每个单元格的高度,只需使用tableView(uu:HeightForRowatingIndexPath

每个单元格的高度相差200-400,因此尝试在
estimatedHeightForRowAtIndexPath
中执行高度计算。由于计算的bcz,我无法准确估计此方法中的高度

willDisplayCell
方法中缓存高度,但滚动仍会跳跃,就像渲染需要时间一样


该单元格类似于Facebook卡片类型的布局,包含大量具有可变高度文本和图像的动态数据。是否有人可以帮助我解决此问题。谢谢

如果您能够计算每个单元格的高度,只需使用tableView(uu:HeightForRowatingIndexPath)而不是EstimatedRowatingIndexPath属性。EstimatedRowheightIndexPath主要用于smthg,如自大小细胞等。

试试这个。我希望这能帮助你。这对我有用。实际上,这会计算显示前的单元格高度。 谢谢

//把这个放进视窗

NSMutableDictionary *cellHeightsDictionary;
//UITableview委托方法

cellHeightsDictionary = @{}.mutableCopy;

你能告诉我更多关于如何计算
表格视图中单元格的高度的信息吗(uuuiMatedHeightForrowatineXpath:)
?NSMutableDictionary*cellHeightsDictionary;//在代码cellHeightsDictionary=@{}.mutableCopy中初始化;thnks@yogesh我一定会尝试,但我最终删除了autolayout,并使用AsyncdisplayKit在基于帧的框架中对其进行编码,以满足ma要求
cellHeightsDictionary = @{}.mutableCopy;
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
NS_AVAILABLE_IOS(7_0)
{
    NSNumber *height = [cellHeightsDictionary objectForKey:indexPath];
    if (height) return height.doubleValue;
    return UITableViewAutomaticDimension;
}

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    [cellHeightsDictionary setObject:@(cell.frame.size.height) forKey:indexPath];

}