【发布时间】:2018-02-27 09:35:34
【问题描述】:
let cell = tableview.dequeueReusableCell(withIdentifier: "cell1") as! viewTableViewCell
let head = titlelist[indexPath.row] as! String
cell.lbl.text = head.uppercased()
if(UIScreen.main.bounds.size.height == 1366)
{
cell.img.heightAnchor.constraint(equalToConstant: 216).isActive = true
cell.img.widthAnchor.constraint(equalToConstant: 395).isActive = true
self.view.updateConstraints()
}
我想在单元格中更改我的 imageview img 的宽度和高度限制。但它没有更新。感谢任何帮助。
【问题讨论】:
-
您是在单独的
Xib中设计此单元还是在Storyboard中作为原型单元? -
我在 Storboard 中做到了
-
您是否以编程方式在单元格中添加 imageView?或者只是使用
Drag & Drop添加 imageView ? -
图像视图使用拖放并给它一个固定的高度和宽度。这适用于iphone。我正在尝试通过代码为 ipad 提供新的高度和宽度限制
-
您也可以使用情节提要。
标签: ios autolayout swift4 xcode9