Skip to content

Instantly share code, notes, and snippets.

@JJSaccolo
Forked from albertodebortoli/AppDelegate.m
Created November 29, 2012 21:53
Show Gist options
  • Select an option

  • Save JJSaccolo/4172166 to your computer and use it in GitHub Desktop.

Select an option

Save JJSaccolo/4172166 to your computer and use it in GitHub Desktop.
iPhone splash screen fade out animation
// in application:didFinishLaunchingWithOptions: in app delegate
// before [window makeKeyAndVisible];
int height;
NSString *imageName;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 480) {
height = 480;
imageName = @"Default.png";
} else {
height = 568;
imageName = @"Default-568h@2x.png";
}
UIImageView *splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, height)];
// after [window makeKeyAndVisible];
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, height)];
splashView.image = [UIImage imageNamed:imageName];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
[UIView animateWithDuration:0.5 animations:^{
[splashView setAlpha:0.0];
} completion:^(BOOL finished) {
[splashView removeFromSuperview];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment