简体   繁体   中英

Swift Change UIContainerView height and width

I have two ContainerView which are placed above each other,for example ContainerA is front of ContainerB.

When a Button tapped ContainerA width and height should change to a smaller size, then ContainerB will be shown.

How can I change height and width of a container view using swift instead of story board? does it have something like transform?

change its frame:

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

or work with its transform property:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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