Using CGAffineTransform(scaleX: 2, y: 2)
will scale up the whole view. Is there any way to transform the view only at the left, right, and top? Like the image below:
CodePudding user response:
You need to adjust your anchorPoint
to CGPoint(x: 0.5, y: 1)
with this your view will be scaled while maintain his y bottom position
customView?.layer.anchorPoint = CGPoint(x: 0.5, y: 1)
UIView.animate(withDuration: 5, animations: { [customView] in
customView?.layer.setAffineTransform(CGAffineTransform(scaleX: 5, y: 5))
})