1
votes

I'm building a game for the iphone and it's only in landscape mode. I want to add launch image in xcode, but I don't get the image to load. How can this be done?

6

6 Answers

2
votes

Change your image using Photoshop or some other image editing software to landscape mode.I mean just rotate the image and save it and use that.There is no other way to do it in XCode.

1
votes

Here is what I did to make launch image work in landscape mode application:

I opened the image in Pixelamtor and rotated it 90 degrees. This made the image 320x480. You can obviously do the same procedure in Photosop, or other image editing program. Then I named the image Default.png and dragged it into xcode. Do the same procedure with your [email protected] launch image, which should be 640x960.

That's it.

The problem I had was that I opened up the iphone simulator the launch image didn't appear. However, when I ran it via the iphone, the launch image appeared. I assume this is a bug in the iphone simulator.

0
votes

Apple tells you how to do this in Advanced App Tricks, which is kind of silly I think, since it seems like a common issue. Scroll down to "Launching in Landscape Mode", and it says:

  • Add the UIInterfaceOrientation key to your app’s Info.plist file and set the value of this key to either UIInterfaceOrientationLandscapeLeft or UIInterfaceOrientationLandscapeRight.
  • Lay out your views in landscape mode and make sure that their autoresizing options are set correctly.
  • Override your view controller’s shouldAutorotateToInterfaceOrientation: method and return YES for the left or right landscape orientations and NO for portrait orientations.

The first one is what gets the OS to recognized you want to launch in landscape. It orients the status bar and tells all view controllers how to orient their views at launch time.

0
votes

EDIT Refer Automatic orientation support for iPhone and iPad apps By Apple

iPhone-only applications:

iPhone-only applications may only have one launch image. It should be in PNG format and measure 320 x 480 pixels. Name your launch image file Default.png.

For iPhone 4 high resolution, you can include an additional launch image. It should be in PNG formate and measure 640 x 960 pixels. Name it [email protected]. This image will get picked up by the iOS if your app is running on an iPhone 4.

Note: If your app is not running on an iPhone 4, and you provided both Default.png and [email protected], iOS will automatically pick up Default.png as the launch image.

iPad-only applications:

Create a launch image for each supported orientation in the PNG format. Each launch image must be 1024 x 748 pixels (for landscape) or 768 x 1004 pixels (for portrait).

Default launch image files:

Default-PortraitUpsideDown.png - upside-down portrait version.

Default-LandscapeLeft.png - left-oriented landscape version.

Default-LandscapeRight.png - right-oriented landscape version.

Default-Portrait.png - generic portrait version.

Default-Landscape.png - generic landscape version.

Default.png - default portrait launch. Its usage is strongly discouraged, use more specific launch images instead.
0
votes

As per my understaning , you want to add a launch image which is shown when the app launches.

Then you just need to name your desired image to "default.png & [email protected] and add those images in project. Then in project navigator go to project>summary scroll down you will see launch images right click and add those images here . All done

0
votes

I ran into the same bug with my landscape-only app. Then I started from scratch with my original iOS 6 project again and suddenly it worked and showed the launch screen on iOS 7 (XCode 5). It seems that XCode 5 gets confused very easily leaving you with a corrupt project so you have to restart from iOS 6 again and be very careful. I think I know what I did wrong to destroy my project so it would only show a black launch screen: I selected the project and under the "General" tab inside the "Launch Images" section I clicked on the folder button and played around with it a bit, adding image files "manually" and stuff. DONT DO THAT! Even if you change it back later (as I also tried to do) your project is corrupted - it seems - and you cant get it to work any more to show the launch screen (at least at the top level, of course you can work your way through to deeper levels, which would cost hours if not days to find the spot that needs to be changed to make it work)..

So restart and fix it as follows, which worked for me:

1) Keep a backup from your iOS 6 project

2) Open your project in XCode 5

3) Add the missing files (eg Default-568h@2x or any other missing files) to your project, by drag and dropping them into the project navigator. XCode will then find it automatically and do the work for you.

Or if you have all files but XCode is telling you that the image aspect ratio is wrong (not 640x1136 pixels...) for one of your launch images then do the following:

1) Close XCode

2) Fix the aspect ratio of your launch image

3) Open XCode and your project and thats it. XCode is checking your launch images and finds that the aspect ratio is ok, and your good to go. No more work needed.

Dont mess around in your project under the "General" tab... and probably also dont mess around in the plist. Do it as above and it should work (it worked for me).

Bottom line: I think the problems only occurs, if you manually try to change your launch images in your project which corrupts your project easily and gives you black launch images. If you let XCode make the work as I described above, your app will work as it should and show the launch image.