iPhone 5 Friendly Splash Screen Fadeout

Just add this code somewhere in your applicationDidBecomeActive function in your AppDelegate and viola!

{syntaxhighlighter brush: csharp;fontsize: 100; first-line: 1; }UIImageView *splash;
if(IS_IPHONE_5)
splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”Default-568h.png”]];
else
splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”Default.png”]];

[self.window.rootViewController.view addSubview:splash];

[UIView animateWithDuration:0.5
animations:^{
splash.alpha = 0;
}
completion:^(BOOL finished) {
[splash removeFromSuperview];
}];
{/syntaxhighlighter}

YOU NEED TO DEFINE IPHONE_5 FIRST! I do so in my .pch, but you can do this anywhere and it looks like:

{syntaxhighlighter brush: csharp;fontsize: 100; first-line: 1; }#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height – ( double )568 ) < DBL_EPSILON ){/syntaxhighlighter}

Leave a comment

Your email address will not be published.