简体   繁体   English

迅速更改UIContainerView的高度和宽度

[英]Swift Change UIContainerView height and width

I have two ContainerView which are placed above each other,for example ContainerA is front of ContainerB. 我有两个彼此叠置的ContainerView,例如ContainerA在ContainerB的前面。

When a Button tapped ContainerA width and height should change to a smaller size, then ContainerB will be shown. 当点击按钮时,ContainerA的宽度和高度应更改为较小的尺寸,然后将显示ContainerB。

How can I change height and width of a container view using swift instead of story board? 如何使用swift而不是故事板来更改容器视图的高度和宽度? does it have something like transform? 它是否具有类似transform的功能?

change its frame: 更改其框架:

let currentContainerViewFrame = containerView?.frame
currentContainerViewFrame?.width -= 200
currentContainerViewFrame?.height -= 200
containerView?.frame = currentContainerViewFrame

or work with its transform property: 或使用其transform属性:

containerView?.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.7, 0.7)

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

相关问题 以编程方式更改 UIImageView Xcode Swift 的高度和宽度 - Programmatically change the height and width of a UIImageView Xcode Swift UIContainerView内容的高度(嵌入式UITableViewController) - UIContainerView height of content (embedded UITableViewController) 更改 html 中图像的宽度和高度 swift IOS 中的文本 - Change width and height of image in html text in swift IOS 无法更改UITableViewCell内部的UIImageView的宽度和高度-Swift - Unable to change the width and height of UIImageView inside a UITableViewCell - swift 我们可以快速更改UIAlertController Buttons的高度和宽度吗? - Can we change the height and width of UIAlertController Buttons in swift 如何使用Swift 3.0使用Swift 3.0更改iOS应用程序中按钮的高度和宽度 - How to change the height and width of a button in iOS app using Swift 4.0 which is developed using Swift 3.0 以编程方式创建UIContainerView()并更改其高度 - Creating a UIContainerView() programmatically and changing its height 在Swift中调整UIWebview的高度/宽度 - Adjusting height/width of UIWebview in Swift Swift:对UIButton的宽度和高度进行动画处理 - Swift : Animate width and height of UIButton 在 Swift 5 中更改 UIView 宽度 - Change UIView width in Swift 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM