func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
let cellHeight = self.promotionListViewList[indexPath.row].tableViewHeight.value
if cellHeight < 0 {
return 1.0
} else {
return cellHeight
}
}
Run Code Online (Sandbox Code Playgroud)
当我取消注释此方法并在iPhone5或iPad2上运行项目时,出现以下异常:
“表格视图行的高度不能为负-为索引路径提供的高度”
然后应用崩溃
但为什么?
我没有用这种方法产生负值。
如果我发表评论,那什么也没发生。