【问题标题】:How to set constraints for Xib for dynamic height of a cell...?如何为 Xib 设置单元格动态高度的约束...?
【发布时间】:2019-02-05 10:06:22
【问题描述】:

我正在使用 xib 显示数据,但如果标签的数据为空,则隐藏标签,但单元格的高度不会根据内容减少。提前感谢您的建议很有帮助

【问题讨论】:

标签: swift autolayout


【解决方案1】:

您应该使用自动布局约束, 没有为标签设置固定高度请连接到顶部和底部

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return UITableViewAutomaticDimension
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-18
    相关资源
    最近更新 更多