Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios TabeView单元格无法正确显示_Ios_Swift_Xcode_Uitableview_Tableview - Fatal编程技术网

Ios TabeView单元格无法正确显示

Ios TabeView单元格无法正确显示,ios,swift,xcode,uitableview,tableview,Ios,Swift,Xcode,Uitableview,Tableview,我的tableview单元格无法正确显示。我不知道是什么问题。当我启动模拟器时,它会显示:我使用了约束,我确信约束是正确的。这就是它需要的:请帮助 将这些添加到代码中 func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return 80.0 } 如果你有多个高度,那么把条件像这样 func tableView(_

我的tableview单元格无法正确显示。我不知道是什么问题。当我启动模拟器时,它会显示:我使用了约束,我确信约束是正确的。这就是它需要的:请帮助

将这些添加到代码中

 func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 80.0
    }
如果你有多个高度,那么把条件像这样

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
    if(indexPath.section == 0){
        return 50
    }else{
      retrn 120
    }
}
或者使用自动标注,根据每个单元格的内容自动调整其大小:

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 
     return UITableViewAutomaticDimension
 }

tableView:heightForRowAtIndexPath:returns?更改rowatinexpath的高度。是否添加已实现的代码?