How to animate the width and height of a UIView in Xcode?

前端 未结 7 655
温柔的废话
温柔的废话 2021-01-30 23:27

I have this subview I want to add to my main view, but make it expand from the origin. I read some of the Apple documentation but I don\'t understand where I am making mistake.

7条回答
  •  既然无缘
    2021-01-30 23:52

    Swift 4

      UIView.animate(withDuration: 0.3, animations: {
            self.whiteBackgroundView.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)
            self.view.layoutIfNeeded()
        }) { (finished) in
            // end of animation
        }
    

提交回复
热议问题