Created
August 26, 2013 03:03
-
-
Save GantMan/6337790 to your computer and use it in GitHub Desktop.
Suggested code for fade-in of splash.
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
def open_screen(screen, args={}) | |
screen = screen.new if screen.respond_to?(:new) | |
self.home_screen = screen | |
self.window ||= self.ui_window.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
self.window.rootViewController = (screen.navigationController || screen) | |
splash_fade = args.respond_to?(:splash_fade) | |
if splash_fade | |
image = (568 == UIScreen.mainScreen.bounds.size.height) ? ("Default-568h") : ("Default") | |
image_view = UIImageView.alloc.initWithImage(UIImage.imageNamed(image)) | |
@window.rootViewController.view.addSubview(image_view) | |
@window.rootViewController.view.bringSubviewToFront(image_view) | |
end | |
self.window.makeKeyAndVisible | |
if splash_fade | |
# fade out splash image | |
UIView.transitionWithView(@window, duration:splash_fade, options:UIViewAnimationOptionTransitionNone, animations: lambda {image_view.alpha = 0}, completion: lambda do |finished| | |
image_view.removeFromSuperview | |
image_view = nil | |
end) | |
end | |
screen | |
end | |
alias :open :open_screen | |
alias :open_root_screen :open_screen | |
alias :home :open_screen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks pretty good! I'll make an issue.
EDIT: Looks like you already did: jamonholmgren/ProMotion#281