我有一个带有 ImageView 的 TableView Controller ,位于原型(prototype)单元内,它有各种大小/位置限制。我想设置编程 View 约束,但是,因为单元格是在“cellForRowAtIndexPath”函数中构建和重新加载的,所以我不确定如何设置它(我不确定在哪里声明原始约束,以便我可以更新 .重新加载每个单元格时保持不变)。
最佳答案
对于遇到此问题的任何人:我的解决方案是在 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 }`
关于ios - 如何快速调整表格单元格内受约束的 imageView 的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30949865/