Animating a UIView
suggest changelet view = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
view.backgroundColor = UIColor.orange
self.view.addSubview(view)
UIView.animate(withDuration: 0.75, delay: 0.5, options: .curveEaseIn, animations: {
// Move to the top-left of self.view. self.view.frame.origin is in
// the superview's coordinates, so it is not the origin inside self.view.
view.frame.origin = .zero
}) { finished in
view.backgroundColor = .blue
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents