2014-09-10 19:28:19 +00:00
|
|
|
import UIKit
|
2014-12-08 22:11:24 +00:00
|
|
|
import Gifu
|
2014-09-10 19:28:19 +00:00
|
|
|
|
|
|
|
class ViewController: UIViewController {
|
|
|
|
|
|
|
|
@IBOutlet weak var imageView: UIImageView!
|
|
|
|
@IBOutlet weak var button: FlatButton!
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
imageView.setAnimatableImage(named: "mugen.gif")
|
2014-11-10 21:57:37 +00:00
|
|
|
imageView.startAnimatingGIF()
|
2014-09-10 19:28:19 +00:00
|
|
|
UIApplication.sharedApplication().setStatusBarStyle(.LightContent, animated: false)
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBAction func toggleAnimation(button: UIButton) {
|
2014-11-10 21:57:37 +00:00
|
|
|
if imageView.isAnimatingGIF {
|
|
|
|
imageView.stopAnimatingGIF()
|
2014-09-10 19:28:19 +00:00
|
|
|
button.layer.backgroundColor = UIColor.whiteColor().CGColor
|
|
|
|
button.setTitleColor(UIColor.blackColor(), forState: .Normal)
|
|
|
|
} else {
|
2014-11-10 21:57:37 +00:00
|
|
|
imageView.startAnimatingGIF()
|
2014-09-10 19:28:19 +00:00
|
|
|
button.layer.backgroundColor = UIColor.clearColor().CGColor
|
|
|
|
button.setTitleColor(UIColor.whiteColor(), forState: .Normal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|