UITableView 在 iOS 8 中很好,但在 iOS7 中崩溃了

UITableView fine in iOS 8 but collapsed in iOS7

我已经查看这个 iOS 应用程序一段时间了,基本上 iOS8 中的表格都很好,但是,当 运行 在 iOS7 中时,它们都没有身高。

原始规范仅要求 iOS8 支持,但由于某些客户仅要求 iPhone4s 向后兼容。下面是正在发生的事情的截图。任何帮助都会很棒。

viewDidLoad

self.myTableView.estimatedRowHeight = 140.0;
self.myTableView.rowHeight = UITableViewAutomaticDimension;

还有这个功能:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:   
                                          (NSIndexPath *)indexPath
{
    return UITableViewAutomaticDimension;
}

在情节提要中,正在折叠的单元格只是基本单元格。具有以下属性:

有条件地改变尺寸

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([[[UIDevice currentDevice]systemVersion]floatValue]>=8.0)
    {
        return UITableViewAutomaticDimension;
    }
    else{
        //Calulate size of cell and return it from here. like as
        return 40;
    }
}