1

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?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ali Lashini
  • 427
  • 1
  • 5
  • 17

1 Answers1

0

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)
André Slotta
  • 13,774
  • 2
  • 22
  • 34