【发布时间】:2015-10-11 08:22:50
【问题描述】:
我有一个带有 uiimageview 的 uitableview。它的高度和宽度(始终为正方形)是通过情节提要中设置的自动布局计算的,并且工作正常。但是当我运行我的应用程序时,tableviewcell 的高度没有更新。我尝试了以下代码来修复它:
tblvwPosts?.rowHeight = UITableViewAutomaticDimension
tblvwPosts?.estimatedRowHeight = 300
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("HomeTableViewCell", forIndexPath: indexPath) as! HomeTableViewCell
cell.setNeedsUpdateConstraints()
cell.updateConstraintsIfNeeded()
return cell
}
但是添加上面的代码后tableviewcell的高度变成了44px。 顺便说一句,我希望有类似于 instagram/facebook 的行,其中将有一个宽度/高度等于设备宽度的方形图像,其下方将是一些标签和按钮。
问候
潘卡伊
【问题讨论】:
标签: swift uitableview