How do I detect orientation on app launch for splash screen animation on iPad?

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 Aug 13 '10 at 21:03.

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.

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

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 :).

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 Aug 15 '10 at 8:23 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 Aug 15 '10 at 8:23.

There are certainly times when you want to transition from the loading image to something else before the user gets control of your app. Unless your app is really simple, going from loading image to landing page probably won't be sufficient without making the app experience really suck. If you ever develop a large app, you'll definitely want to do that to show progress during setup, loading xibs, etc.If an app takes several seconds to prepare with no feedback, users will hate it.

IMO, there's nothing wrong with a nice transition effect either. Almost nobody uses loading screens the way Apple suggests to. I don't know which apps you looked at that showed the "empty UI" type loading screens they suggest.

Heck, even Apple doesn't do that except in their sample code and none of my clients would find that acceptable. It's a lame design.

Eh.. that was in response to Alex. – Dave Nov 12 '10 at 1:09.

To know at start what is the orientation (UIDevice orientation don't work until user have rotate the device) intercept shouldAutorotateToInterfaceOrientation of your View Controller, it is called at start, and you know your device orientation.

I had troubles with this and I solved it by making one image 1024x1024 and setting the contentMode of the UIImageView to UIViewContentModeTop, then using left and right margin autoresizing. So long as your portrait and landscape default images are the same layout then this will work fine. Just to clarify here's what I used: bgView = UIImageView alloc initWithImage:UIImage imageNamed:SplashImage; bgView.

AutoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; bgView. ContentMode = UIViewContentModeTop.

Only the first view added to the window is rotated by the OS. So if you want your splash screen to automatically rotate AND your main view is rotatable then just add it as a child of that view. Here is my code for fading out the appropriate splash screen image: // Determine which launch image file NSString * launchImageName = @"Default.

Png"; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { if (UIDeviceOrientationIsPortrait(UIDevice currentDevice orientation)) { launchImageName = @"Default-Portrait. Png"; } else { launchImageName = @"Default-Landscape. Png"; } } // Create a fade out effect UIImageView* whiteoutView = UIImageView alloc initWithFrame:self.window.

Frame autorelease; whiteoutView. AutoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; whiteoutView. AutoresizesSubviews = YES; whiteoutView.

Image = UIImage imageNamed:launchImageName; self. Window subviews objectAtIndex:0 addSubview:whiteoutView; UIView beginAnimations:nil context:nil; UIView setAnimationDuration:0.5; whiteoutView. Alpha = 0.0; UIView commitAnimations; Note: You'll have to update it to support hi-res screens.

1 Does not work, UIDevice currentDevice orientation is "undefined" for splash screen use. – Kendall Helmstetter Gelner Aug 23 at 22:21.

User372744 has suggested that using a VC is a work around. This seems good to me, but I can't get the VC to detect its orientation when loaded in order to assign the proper splash image. Would user372744 mind posting some code?

You should write this in a comment in user372744's answer – tipycalFlow 2 days ago.

There are certainly times when you want to transition from the loading image to something else before the user gets control of your app. Unless your app is really simple, going from loading image to landing page probably won't be sufficient without making the app experience really suck. If you ever develop a large app, you'll definitely want to do that to show progress during setup, loading xibs, etc. If an app takes several seconds to prepare with no feedback, users will hate it.

IMO, there's nothing wrong with a nice transition effect either. Almost nobody uses loading screens the way Apple suggests to. I don't know which apps you looked at that showed the "empty UI" type loading screens they suggest.

Heck, even Apple doesn't do that except in their sample code and none of my clients would find that acceptable. It's a lame design.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions