IOS Launch Image For Landscape Only App for iPhone’s

Nearing the end of an app development cycle it came time to add a splash screen or in IOS SDK terms the LaunchImage.  The app in question is to be locked in landscape mode as per request of the client.  There is no way to specify a launch image for phones in landscape mode.  If you are using Images.xcassets then you have probably already noticed this.

The following is a very quick and simple way to fix this.

  1. To start, you will need to design your launch image using portrait dimensions.  This is very simple, just rotate the image you want to use as a launch image by 90 degrees.
  2. There are several ways to specify your Launch Image and this is not the subject of this document.  For me I used Images.xcassets to setup the Launch Images.  Take your rotated landscape ready portrait dimensions image and place it into the Images.xcassets appropriately.
  3. Re-Enable portrait mode in your Application Settings.  You can do this via YOURAPP-Info.plist or in the project settings.  Make sure if you do it within YOURAPP-Info.plist that portrait mode is first.
  4. Add the following code snippet to AppDelegate.m (change that return value appropriately for your app):

    -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {

    return UIInterfaceOrientationMaskLandscapeRight;

    }

     

  5. Everything is working now however you will notice that the status bar appears in a funny position.  Add the following the YOURAPP-Info.plist:
           “Status bar is initially hidden” -> YES

There you have it.  Landscape mode locked application with a clean launch image.

Enjoy!

Halsafar

Leave a Reply