![](/img/trans.png)
[英]Programmatically change the height and width of a UIImageView Xcode Swift
[英]Swift Change UIContainerView height and width
我有兩個彼此疊置的ContainerView,例如ContainerA在ContainerB的前面。
當點擊按鈕時,ContainerA的寬度和高度應更改為較小的尺寸,然后將顯示ContainerB。
如何使用swift而不是故事板來更改容器視圖的高度和寬度? 它是否具有類似transform的功能?
更改其框架:
let currentContainerViewFrame = containerView?.frame
currentContainerViewFrame?.width -= 200
currentContainerViewFrame?.height -= 200
containerView?.frame = currentContainerViewFrame
或使用其transform屬性:
containerView?.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.7, 0.7)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.