-
-
Save BrunoVillanova/8725717 to your computer and use it in GitHub Desktop.
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
//.. do other setup | |
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; | |
// Transition neatly from splash screen | |
// Very odd, on iPhone 5 you need to position the splash screen differently.. | |
UIImage* myImage; | |
if ([UIScreen mainScreen].scale == 2.f && screenHeight == 568.0f) { | |
myImage = [UIImage imageNamed:@"[email protected]"]; | |
self.splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,20, 320, screenHeight-20)]; | |
} else { | |
myImage = [UIImage imageNamed:@"Default.png"]; | |
self.splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, screenHeight)]; | |
} | |
self.splashView.image = myImage; | |
[self.window addSubview:self.splashView]; | |
[self.window bringSubviewToFront:self.splashView]; | |
// setup the animation of the splash screen | |
[UIView beginAnimations:nil context:nil]; | |
[UIView setAnimationDuration:1.0]; | |
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES]; | |
[UIView setAnimationDelegate:self]; | |
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; | |
self.splashView.alpha = 0.0; | |
[UIView commitAnimations]; | |
} | |
// Called when the animation that hides Default.png finishes, use it to clean up. | |
- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { | |
[self.splashView removeFromSuperview]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment