3

I am developing an universal app using Unity3D and Xcode. The iPhone version works just perfect and its orientation is portrait. The splash screen comes up fine in portrait mode.

Now, everything in my iPad version also works great except the splash screen. The iPad version is only in landscape mode and as such the splash screen is created, but... When running it on an iPad, the splash screen starts out fine as it should, in landscape, but at some point, it jumps to portrait mode? I can't figure out why and find where to resolve this.

Does anyone have had the same problem or know where to look?

Hoping for help and thanks in advance.

Jules
  • 14,200
  • 13
  • 56
  • 101
Mansa
  • 2,277
  • 10
  • 37
  • 67
  • 1
    Could you post some relevant code? EDIT: It would also help if you posted which hardware and software (iPad version and iOS version) you're trying this on. – Jules Mar 23 '13 at 21:50
  • Did you have a look at this? http://stackoverflow.com/questions/3477582/how-do-i-detect-orientation-on-app-launch-for-splash-screen-animation-on-ipad – krisgo Mar 23 '13 at 21:54
  • I am trying this on iPhone 4s and 5 and iPad 2 EDIT: It seems tp jump when this goes on: -> force accelerometer registration – Mansa Mar 23 '13 at 22:00
  • And yet again... Removed accelerometer and still the same. This is the last message before jump: -> applicationDidBecomeActive() – Mansa Mar 23 '13 at 22:13

3 Answers3

1

Unity shows the splash screen a second time while it is loading the first scene (prior to that, it is iOS showing the splash image). Look at SplashScreen.mm in the XCode project and you'll see a class dedicated to this. The ShowSplashScreen() method is called from the iPhone_View class once the view controller and views are set up.

I had a similar problem to you after updating Unity versions (one of the 4.x updates I think). I had customizations in my XCode files (some included changing the views and overriding the splashscreen stuff). As a result, I always just 'Append' to XCode when building my Unity project. To fix the problem, I had to remove my existing XCode project, allow unity to create a new one from scratch, and then manually port over my customizations.

mikewoz
  • 146
  • 2
  • 9
0

use this for showing splash on main window... this will rotate the image into landscape mode

  splash = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, self.window.frame.size.height+255, self.window.frame.size.width)];
  splash.transform = CGAffineTransformMakeRotation(270* M_PI / 180.0);


  splash.image = [UIImage imageNamed:@"final"];
  [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
  [self.window addSubview:splash];
  [self.window makeKeyAndVisible];
Yogesh Kumar
  • 289
  • 4
  • 4
0

For anyone experiencing this issue, i solved this by adding the following lines in Info.plist:

<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationLandscapeRight</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
</array>