0

I have an iPad app that runs in landscape mode only.

I am creating a view to act as a splash screen as soon as possible, because some database fiddling is needed before the first screen is loaded. The code I use in the appDelegate is:

self.window = [[UIWindow alloc] init];
UIImageView * splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,1024,768)];
splashView.image = [UIImage imageNamed:@"LaunchImage-700-Landscape@2x~ipad"];
[self.window addSubview:splashView];
self.window.hidden = NO;

My problem is that the image is shown rotated 90 degrees. The left 256 pixels are black, rest is showing the image clipped. If I change the frame to 768 x 1024, the entire screen is used for the image, but it is rotated and stretched to fit. I tried a rotation transform on the view, but then the view is offset both horizontal and vertical.

Bjinse
  • 1,339
  • 12
  • 25

2 Answers2

0

Thanks to YarGnawh I am now creating the splashview in the rootViewController instead of directly under the window as follows:

self.window = [[UIWindow alloc] init];
UIImageView * splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,1024,768)];
splashView.image = [UIImage imageNamed:@"LaunchImage-700-Landscape@2x~ipad"];
UIViewController * splashController = [[UIViewController alloc] init];
splashController.view = splashView;
self.window.rootViewController = splashController;

And this works as a charm!

Bjinse
  • 1,339
  • 12
  • 25
0

You could save the picture already rotated into landscape mode and add that picture to your view. Or you could rotate it and change the origin accordingly. You have to subtract the height of the picture from the y origin. (0, -768, 1024, 768). Or something like it.

brixtar
  • 236
  • 3
  • 17