如何在 swift 中的 table 单元格内调整受限 imageView 的大小?

How do I resize a constrained imageView, inside a table cell, in swift?

我在原型单元格内有一个带有图像视图的 table 视图控制器,它有各种 size/location 约束。我想设置编程视图约束但是,因为单元格是在 "cellForRowAtIndexPath" 函数中构建和重新加载的,所以我不确定如何设置它(我不确定在哪里声明原始约束以便我可以更新重新加载每个单元格时的 .constant)。

对于遇到此问题的任何人:我的解决方案是在 UITableViewCell 中创建一个 IBOutlet。然后,在构建单元格时,在 cellForRowAtIndexPath 中调用动画:

cell.itemRightSpace.constant = 100
cell.item1.layoutIfNeeded()

UIView.animateWithDuration(0.75, delay: 0.3, options: nil, animations: { () -> Void in

            cell.progress1RightSpace.constant = 0
            cell.progress1.layoutIfNeeded()

            }) { (isFinished) -> Void in }`