Created
September 5, 2012 21:01
-
-
Save GantMan/3644690 to your computer and use it in GitHub Desktop.
Code for RubyMotion Splash Screen Blog: http://iconoclastlabs.com/cms/blog/posts/iphone-splash-screen-with-rubymotion
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
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
@window.rootViewController = RootController.alloc.init | |
#Splash Screen | |
image_view = UIImageView.alloc.initWithImage(UIImage.imageNamed("Default.png")) | |
@window.rootViewController.view.addSubview(image_view) | |
@window.rootViewController.view.bringSubviewToFront(image_view) | |
# normal | |
@window.makeKeyAndVisible | |
# fade out splash image | |
fade_out_timer = 1.0 | |
UIView.transitionWithView(@window, duration:fade_out_timer, options:UIViewAnimationOptionTransitionNone, animations: lambda {image_view.alpha = 0}, completion: lambda do |finished| | |
image_view.removeFromSuperview | |
image_view = nil | |
UIApplication.sharedApplication.setStatusBarHidden(false, animated:false) | |
end) | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
first off all thanks for sharing. This is great piece of code. I have only one problem, when the Splash Screen fades out the Navigation Bar is half hidden behind the Status Bar.
I am using your code within a TabbarApplication. Do you have any ideas what is going wrong there?