Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.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 调整表格视图单元格高度以适应按钮_Ios_Swift_Xcode_Tableview - Fatal编程技术网

Ios 调整表格视图单元格高度以适应按钮

Ios 调整表格视图单元格高度以适应按钮,ios,swift,xcode,tableview,Ios,Swift,Xcode,Tableview,我试图让我的表视图单元格看起来像主故事板上的单元格。我有一个标签,下面有两个按钮。我不能让单元格只显示标签的一行。我可以用标签增加高度,但不是所有的东西都适合。我希望它看起来像故事板单元,但它看起来像这样 您是否尝试过使用这些函数?我不这么认为,只需使用UITableView提供的这些默认委托,看看它是否对您有帮助 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFlo

我试图让我的表视图单元格看起来像主故事板上的单元格。我有一个标签,下面有两个按钮。我不能让单元格只显示标签的一行。我可以用标签增加高度,但不是所有的东西都适合。我希望它看起来像故事板单元,但它看起来像这样


您是否尝试过使用这些函数?我不这么认为,只需使用UITableView提供的这些默认委托,看看它是否对您有帮助

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

    func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
        return UITableViewAutomaticDimension
    }
其次,如果您使用的是故事板中的tableView

从“自定义”取消勾选行高


那么,你打算怎么办?您负责单元格高度。@Michael.R只需增加单元格高度,不要发布代码的图像。向下投票,因为这感觉就像您不懂一样。查看
tableView(\utableview:UITableView,heightForRowAt indexPath:indexPath)->CGFloat
@dfd,或者使用autolayout正确设置单元格,并使用
UITableView自动标注。但不管怎样,很明显细胞太短了。