Commit d7920e58 authored by toby's avatar toby

properly handle unpause/finish

parent b14c3d0e
......@@ -78,6 +78,9 @@ extension RootViewController: StateMachineDelegate {
let prezLayer = background.layer.presentationLayer() as? CALayer
pausedBackgroundColor = UIColor(CGColor: prezLayer!.backgroundColor!)
background.pause()
case (.PausedBackground, .Finished):
background.backgroundColor = pausedBackgroundColor
background.unpause()
case (.PausedBackground, .AnimatingBackground):
pausedBackgroundColor = nil
background.unpause()
......@@ -116,10 +119,6 @@ class RootViewController: UIViewController {
override func viewWillAppear(animated: Bool) {
navigationController!.setNavigationBarHidden(true, animated: false)
println("unpause \(pausedBackgroundColor)")
if (pausedBackgroundColor != nil) {
println("show it")
}
}
override func loadView() {
......@@ -212,7 +211,7 @@ class RootViewController: UIViewController {
UIView.animateWithDuration(
self.backgroundTransition.duration,
delay: 0.0,
options: UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowUserInteraction,
options: UIViewAnimationOptions.CurveEaseOut,
animations: {
self.background!.backgroundColor = self.backgroundTransition.endColor
},
......@@ -221,7 +220,7 @@ class RootViewController: UIViewController {
UIView.animateWithDuration(
0.25,
delay: 0.0,
options: UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.AllowUserInteraction,
options: UIViewAnimationOptions.CurveEaseInOut,
animations: {
self.background!.backgroundColor = UIColor.whiteColor()
......@@ -232,7 +231,7 @@ class RootViewController: UIViewController {
UIView.animateWithDuration(
0.25,
delay: 0.0,
options: UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.AllowUserInteraction,
options: UIViewAnimationOptions.CurveEaseInOut,
animations: {
self.background!.backgroundColor = self.backgroundTransition.startColor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment