From f2fb5c5e4085431b22a3510ed3d4a317d10c0dab Mon Sep 17 00:00:00 2001 From: Tony DiPasquale Date: Fri, 5 Jun 2015 11:14:52 -0400 Subject: [PATCH] Add a toggle for both gifs --- Demo/demo/Main.storyboard | 20 ++++++++++++++++++-- Demo/demo/classes/ViewController.swift | 12 +++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Demo/demo/Main.storyboard b/Demo/demo/Main.storyboard index 6353d8e..ce1c3a9 100755 --- a/Demo/demo/Main.storyboard +++ b/Demo/demo/Main.storyboard @@ -1,7 +1,7 @@ - + - + @@ -46,6 +46,19 @@ + + + + + + + + + + + + + @@ -56,7 +69,10 @@ + + + diff --git a/Demo/demo/classes/ViewController.swift b/Demo/demo/classes/ViewController.swift index 83732ad..e6584f9 100755 --- a/Demo/demo/classes/ViewController.swift +++ b/Demo/demo/classes/ViewController.swift @@ -9,7 +9,7 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - imageView.animateWithImage(named: "almost_nailed_it.gif") + imageView.animateWithImage(named: "mugen.gif") UIApplication.sharedApplication().setStatusBarStyle(.LightContent, animated: false) } @@ -25,5 +25,15 @@ class ViewController: UIViewController { button.setTitleColor(UIColor.whiteColor(), forState: .Normal) } } + + @IBAction func toggleGIF(sender: UISegmentedControl) { + imageView.stopAnimatingGIF() + + switch sender.selectedSegmentIndex { + case 0: imageView.animateWithImage(named: "mugen.gif") + case 1: imageView.animateWithImage(named: "almost_nailed_it.gif") + default: imageView.image = .None + } + } }