【问题标题】:UITableView setting heightForRowAt is CGFloat.leastNormalMagnitude , but it's crashUITableView 设置 heightForRowAt 是 CGFloat.leastNormalMagnitude ,但它的崩溃
【发布时间】:2017-05-04 08:27:10
【问题描述】:

我的 tableView 设置

appTableView.estimatedRowHeight = 200
appTableView.rowHeight = UITableViewAutomaticDimension

然后我设置单元格的高度

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
   if indexPath == kFirstCellIndexPath && category == .overtime {
     return CGFloat.leastNormalMagnitude // it will crash
     return 0  // it will not crash
   } else {
     return UITableViewAutomaticDimension
   }
}

当我重新加载tableView,但它是崩溃,为什么?

【问题讨论】:

标签: ios swift uitableview


【解决方案1】:

替换这一行

    return CGFloat.leastNormalMagnitude 

与

  return  CGFloat(FLT_MIN)

在表格视图的heightForRowAtIndexpath 方法中。

【讨论】:

    猜你喜欢
    • 2017-07-03
    • 2013-01-11
    • 1970-01-01
    • 2023-03-14
    • 2019-02-11
    • 2018-07-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多