3
votes

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.

3
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
Did you have a look at this? stackoverflow.com/questions/3477582/…krisgo
I am trying this on iPhone 4s and 5 and iPad 2 EDIT: It seems tp jump when this goes on: -> force accelerometer registrationMansa
And yet again... Removed accelerometer and still the same. This is the last message before jump: -> applicationDidBecomeActive()Mansa

3 Answers

1
votes

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.

0
votes

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];
0
votes

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>