Since bounds is an animatable property of UIView, I wanted to see what happened if I animated the x and y values of a view's bound's origin.
My view (view1) has a UILabel inside of it.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIView.animate(withDuration: 2, delay: 0.0, animations: {
self.view1.bounds.origin.y = 50
})
}
Doing so makes the label animate upwards (50). Similarly, if y is negative, the label will animate downwards. Animating x causes similar behaviour...setting a positive x in the animate block makes the label animate left and negative x makes the label animate right.
The documentation and samples I've looked at don't explain enough about animating bounds x/y so I don't understand what's going on.
Can someone explain the behaviour I'm seeing?
Thanks.