I am using Cocos2d and Xcode 4. My app currently displays the launch image in portrait mode, then switches to landscape so the image is on its side, then launches the app. How can I: 1. Make it run the launch image for a certain duration. 2. Make it display it in Landscape mode, not portrait. Any Help is appreciated. Thanks!
5 Answers
To make your launch image display in landscape mode, simply append -Landscape
to its filename (e.g. change LaunchImage.png
to LaunchImage-Landscape.png
).
As for showing your launch image for a certain duration, you have two options: display a "launch image" view controller initially and dismiss it after the desired duration (allows you to fade the image out, etc.), or simply call sleep()
in your app delegate's application:didFinishLaunchingWithOptions:
. It's important to note that you have no control over how long the OS displays your launch image before control is passed to your app delegate—you need to take this into consideration.
In AppDelegate applicatio:didFinishLaunchingWithOptions
there is a call to
[director_ pushScene: [IntroLayer scene]]
. In there, it shamelessly loads the splash screen again and displays it rotated by 90 degrees:
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) {
background = [CCSprite spriteWithFile:@"Default.png"];
background.rotation = 90;
}
Removing this fixes the rotating splash screen problem.