0

Hopefully somebody can point out what I'm doing wrong with my Splash screen here. The problem is that the screen is displaying in portrait mode, not landscape...

- (void)showSplash
{    
UIView *modelView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1024 , 748)];

UIViewController *modalViewController = [[UIViewController alloc] init];
[modelView setBackgroundColor:[[UIColor alloc] initWithPatternImage:[UIImage     imageNamed:@"Splash.png"]]];

modalViewController.view = modelView; 

[self presentModalViewController:modalViewController animated:NO];


[self performSelector:@selector(hideSplash) withObject:nil afterDelay:5.0];

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

Thanks in advance for the help.

please delete me
  • 819
  • 2
  • 14
  • 29
Nathan
  • 1,609
  • 4
  • 25
  • 42

2 Answers2

1

Looks like you are writing app for iPad. If so, you have to support both landscape as well as portrait orientation otherwise Apple will reject it. I would suggest that you should use two different images. Image specifications are as follows:

  1. Default-Landscape.png (1004 * 768)
  2. Default-Portrait.png (748*1024)

(I am assuming that you are showing status bar if not add 20 pixels to height of an image)

That's it, create these images and add it to your project. And you are good to go. No Need to write any additional piece of code too..

And ya make it

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
slonkar
  • 4,055
  • 8
  • 39
  • 63
  • Actually this app is only supporting landscape orientation, According to Apple the suggest that you support all, but they do not require it .. http://developer.apple.com/library/ios/#qa/qa1689/_index.html – Nathan Nov 09 '11 at 20:20
0

You shouldn't rely on a function in your code to display the splash screen. Just define them as the previous answer from Sumit Lonkar explains.

If you do it in code, I believe at the start of the application the orientation is always considered as portrait, then the transition to the actual orientation is triggered. This explains why your code displays first as portrait and most likely there is nothing else in the code to handle rotation. Besides, the purpose of the splash screen is to display something while the app is loading, so if you put it in code you lose the purpose.

By doing it the Apple way you leave it to another Apple process that runs before looking at your code and it will work.

Regarding the orientation supported I have on my iPad some apps that support only landscape (TapZoo for example) so it should be ok with Apple.

gregory
  • 826
  • 1
  • 6
  • 6