NO UIVIEW ANIMATIONS, I'M LEARNING CORE ANIMATION
When I run this code, the top
image is not on the screen. Then 4 seconds later, it reappears and does as expected. Not sure why. What I want is for the top
image to be on the screen when the app launches, and then 4 seconds later for the top
image to move up and out of the screen.
@IBOutlet var top: UIImageView!
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let openTop = CABasicAnimation(keyPath: "position.y")
openTop.fromValue = self.top.frame.origin.y
openTop.toValue = -self.view.bounds.size.height
openTop.duration = 1.0
openTop.beginTime = CACurrentMediaTime() + 4
self.top.layer.addAnimation(openTop, forKey: nil)
self.top.layer.position.y = -self.view.bounds.size.height
}
Any thoughts?