2016-10-06 20:45:03 +00:00
|
|
|
import UIKit
|
|
|
|
import Gifu
|
|
|
|
|
|
|
|
class EmptyViewController: UIViewController {
|
|
|
|
let imageView = GIFImageView(image: #imageLiteral(resourceName: "mugen.gif"))
|
|
|
|
|
2016-10-08 17:36:32 +00:00
|
|
|
lazy var customImageView: CustomAnimatedView = {
|
|
|
|
return CustomAnimatedView(frame: CGRect(x: 0, y: self.view.frame.height - 200, width: 360, height: 200))
|
|
|
|
}()
|
|
|
|
|
2016-10-06 20:45:03 +00:00
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
view.addSubview(imageView)
|
2016-10-08 17:36:32 +00:00
|
|
|
view.addSubview(customImageView)
|
2016-10-06 20:45:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
|
|
imageView.animate(withGIFNamed: "mugen")
|
2016-10-08 17:36:32 +00:00
|
|
|
customImageView.animate(withGIFNamed: "earth")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CustomAnimatedView: UIView, GIFAnimatable {
|
|
|
|
public lazy var animator: Animator? = {
|
|
|
|
return Animator(withDelegate: self)
|
|
|
|
}()
|
|
|
|
|
|
|
|
override public func display(_ layer: CALayer) {
|
|
|
|
updateImageIfNeeded()
|
2016-10-06 20:45:03 +00:00
|
|
|
}
|
|
|
|
}
|