title: iOS 5.1 and Default.png
body: <p>I am developing an application using iOS 5.1 and I am experiencing some strange behavior with the default.png files.</p>
  <p>I have added the following files to my application:</p>
  <blockquote>
  <p>Default.png - (iPhone)</p>
  <p>Default@2x.ping - (iPhone Retina)</p>
  <p>Default-Portrait~ipad.png - (iPad)</p>
  <p>Default-Portrait@2x~ipad.png -(iPad Retina)</p>
  </blockquote>
  <p>When the application starts it seems that it selects the correct Default.png image to use for each occasion. However in my AppDelegate I have a simple splash screen to make smoother the loading of the application and the transition to the app, doing something like:</p>
  <pre><code>UIImageView *splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,window.frame.size.width, window.frame.size.height)]; 
  splashView.image = [UIImage imageNamed:@&quot;Default&quot;]; 
      
  [window addSubview:splashView]; 
  [window bringSubviewToFront:splashView]; 
  </code></pre>
  <p>However the <code>[UIImage imageNamed:@&quot;Default&quot;]</code> in turn does not select the correct file for each device, and I believe the problem is the <code>-Portrait</code> part of the filename.</p>
  <p>So as a quick solution I did this:</p>
  <pre><code>if( ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ) {
      // Force the image used by ipads
      if( [[UIScreen mainScreen] respondsToSelector:@selector(scale)] &amp;&amp; [[UIScreen mainScreen] scale] == 2.0) {
         splashView.image = [UIImage imageNamed:@&quot;Default-Portrait@2x~ipad&quot;];
      }
      else {
          splashView.image = [UIImage imageNamed:@&quot;Default-Portrait~ipad&quot;];
      }
  }
  else
     splashView.image = [UIImage imageNamed:@&quot;Default&quot;];
  </code></pre>
  <p>Is this how I should be doing this? Does this look funny to you?</p>