iPhone 5 Friendly Splash Screen Fadeout

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

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];
                 }];

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

#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.

More information about formatting options

CAPTCHA
Complete this form and then pat yourself on the back.