Skip to content

Instantly share code, notes, and snippets.

@mluton
Created December 28, 2012 07:23
Show Gist options
  • Save mluton/4395363 to your computer and use it in GitHub Desktop.
Save mluton/4395363 to your computer and use it in GitHub Desktop.
Simple Splash Screen for iOS
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
UIImageView*imageView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Default.png"]];
[[self.viewController view] addSubview:imageView];
[[self.viewController view] bringSubviewToFront:imageView];
[self.window makeKeyAndVisible];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[UIView transitionWithView:self.window
duration:0.25f
options:UIViewAnimationOptionTransitionNone
animations:^(void) {
[application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
imageView.alpha = 0.0f;
}
completion:^(BOOL finished) {
[imageView removeFromSuperview];
}
];
});
return YES;
}
@mluton
Copy link
Author

mluton commented Dec 28, 2012

Does not work for tab bar controllers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment