繁体   English   中英

如何快速调整表格单元格内受约束的imageView的大小?

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

我在原型单元中有一个带有图像视图的表视图控制器,其上具有各种大小/位置约束。 我想设置程序化视图约束,但是由于单元是在“ 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 }`

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM