-
-
Save JJSaccolo/4172166 to your computer and use it in GitHub Desktop.
iPhone splash screen fade out animation
This file contains hidden or 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
| // 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