Commit 82bb94fe authored by toby's avatar toby

swipe to change transition

parent 239f3246
......@@ -34,7 +34,7 @@ func randomColor() -> UIColor {
func randomTransition() -> BGTransition {
// let duration = Double((arc4random() % 5) + 5)
let duration = 5.0
let duration = 2.0
var start = randomColor()
var end = randomColor()
return BGTransition(duration: duration, startColor: start, endColor: end)
......@@ -76,7 +76,8 @@ class ViewController: UIViewController {
let hold = UILongPressGestureRecognizer(target: self, action: Selector("backgroundHeld:"))
view.addGestureRecognizer(hold)
let swipe = UISwipeGestureRecognizer(target: self, action: Selector("swiped:"))
view.addGestureRecognizer(swipe)
}
override func didReceiveMemoryWarning() {
......@@ -84,6 +85,10 @@ class ViewController: UIViewController {
// Dispose of any resources that can be recreated.
}
@IBAction func swiped(swipe: UISwipeGestureRecognizer) {
self.backgroundTransition = randomTransition()
}
@IBAction func backgroundHeld(hold: UILongPressGestureRecognizer) {
switch hold.state {
case UIGestureRecognizerState.Began:
......
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