views:

435

answers:

4

Hi I have an app and I have two *.pngs for default splash screen:

Default-Landscape.png Default-Portrait.png

What I want is to animate this default splash screen away when my app is loaded and ready to go.

To achieve this I would normally present an UIImageView with either default-landscape or default-portrait (depending on the device orientation), keep it on screen for a certain time and then animate it away.

My problem is that if I call [[UIDevice currentDevice] orientation] in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

The answer is always that the device is in portrait orientation even if I clearly have it in landscape. I tried this in simulator and on the device as well and the behaviour is the same.

Does anyone know a fix for this or maybe some other approach?

Thanks!

+1  A: 

Maybe you could show a blank view with black background at start time and place [[UIDevice currentDevice] orientation] into this view's viewDidAppear and start your splash screen from there?

tob
This would work and do what you wanted, but it goes against the guidelines in the iOS HIG -- the launch image isn't meant to be a splash screen, and iOS apps shouldn't use splash screens.
Alex Martini
A: 

Another solution would be to read the accelerometer data and determine the orientation yourself.

eliego
A: 

It sounds like you're not using the launch image the way Apple recommends in the iOS HIG. It specifically calls out that you should not use it as a splash screen, but rather as a skeleton version of your actual UI. The net effect is that your app appears to be ready just that much faster.

The suggestions that you could draw a splash screen yourself after the app has launching in viewDidAppear or similar also are missing the basic purpose of a launch image. It's not a splash screen. If your app is ready, let the user interact with it, don't waste their time drawing a splash screen.

From my five minute survey of Apple apps and third-party apps, everyone showed a portrait launch image, loaded the portrait version of the UI, and then rotated to landscape. It's been a while since programming on iOS, but I think this mirrors the order of the method calls -- first your app gets launched, then it is told to rotate to a particular orientation.

It might be a nice enhancement request to file with Apple though :)

Alex Martini
Thank you for the documented response. I do have a different opinion though.Apple recommends that you should use a skeleton version of your actual UI to fool the user that the app is loading faster than it actually is. Going past this minor trick most apps use a splash screen with the company's logo or something attractive to get the user attention until the app is ready to go.
Horatiu Paraschiv
What I want to do is make the transition between the splash screen and my UI smoother (add an effect) thus improving the user experience. The transition would be 0.3-0.5 seconds at most so I don't think the user would feel that this is a waste of their time.
Horatiu Paraschiv
+1  A: 

To get around this problem I installed the splash image view inside of a view controller that allowed both orientations. Even though the device reported the wrong orientation at startup, the view controller seems to get the right one.