-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Miscallaneous] Add splash animation.
- Loading branch information
nsakaimbo
committed
Jul 22, 2016
1 parent
770741c
commit 9a911d9
Showing
3 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import FLAnimatedImage | ||
import UIKit | ||
|
||
class AppViewController: UIViewController { | ||
|
||
var API: Networking! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
view.backgroundColor = .whiteColor() | ||
|
||
let imageView = FLAnimatedImageView() | ||
|
||
let image: FLAnimatedImage = { | ||
let url = NSBundle.mainBundle().URLForResource("dancing_abe", withExtension: "gif") | ||
let data = NSData(contentsOfURL: url!) | ||
let _image = FLAnimatedImage(animatedGIFData: data) | ||
return _image | ||
}() | ||
|
||
imageView.contentMode = .ScaleAspectFit | ||
imageView.animatedImage = image | ||
|
||
imageView.translatesAutoresizingMaskIntoConstraints = false | ||
view.addSubview(imageView) | ||
imageView.heightAnchor.constraintEqualToConstant(300).active = true | ||
imageView.widthAnchor.constraintEqualToConstant(300).active = true | ||
imageView.centerXAnchor.constraintEqualToAnchor(view.centerXAnchor).active = true | ||
imageView.centerYAnchor.constraintEqualToAnchor(view.centerYAnchor).active = true | ||
} | ||
|
||
|
||
override func viewDidAppear(animated: Bool) { | ||
super.viewDidAppear(animated) | ||
|
||
let delay = dispatch_time(DISPATCH_TIME_NOW, Int64(3 * Double(NSEC_PER_SEC))) | ||
dispatch_after(delay, dispatch_get_main_queue()) { [weak self] in | ||
let trendingViewController = GIFCollectionViewController() | ||
trendingViewController.API = self?.API | ||
let navigationController = UINavigationController(rootViewController: trendingViewController) | ||
self?.presentViewController(navigationController, animated: true, completion: nil) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters