启动画面不会改变iPad的方向?

时间:2011-12-22 07:45:22

标签: ipad splash-screen orientation-changes

我在iPad应用程序中工作。我有4个图像用于Splash屏幕(Landscape Right,Left和Portrait,PortraitUpsideDown)。当我在纵向模式下启动应用程序时,启动画面显示效果很好,但是我将方向改为Landscaper,启动画面不会改变其方向。能告诉我任何想法吗?今天我需要提交应用程序。请帮我。提前致谢。这是我的代码,

 -(void) showSplash
{
    UIInterfaceOrientation orientation= [[UIApplication sharedApplication] statusBarOrientation];
    if (orientation == UIInterfaceOrientationLandscapeLeft ||
        orientation == UIInterfaceOrientationLandscapeRight)  //  UIDeviceOrientationLandscapeLeft
    {       
        NSLog(@"Splash Landscape");
        UIViewController *splash=[[UIViewController alloc] init];
        splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
        splachview.image=[UIImage imageNamed:@"Default-Landscape.png"];
        [splash.view addSubview:splachview];

        splachview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
        splachview.contentMode = UIViewContentModeTop;

        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
        [self presentModalViewController:splash animated:NO];
        [self performSelector:@selector(hideSplash) withObject:nil afterDelay:10.0];
        [splash release];
        [splachview release];
    }
    else if (orientation == UIInterfaceOrientationPortrait ||
             orientation == UIInterfaceOrientationPortraitUpsideDown) //  UIDeviceOrientationPortrait
    {
        NSLog(@"Splash Portrait");
        UIViewController *splash=[[UIViewController alloc] init];
        splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
        splachview.image=[UIImage imageNamed:@"Default-Portrait.png"];
        [splash.view addSubview:splachview];

        splachview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
        splachview.contentMode = UIViewContentModeTop;

        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
        [self presentModalViewController:splash animated:NO];
        [self performSelector:@selector(hideSplash) withObject:nil afterDelay:10.0];
        [splash release];
        [splachview release];
    }   
}

请纠正我的错误。闪屏不会改变其方向。感谢。

1 个答案:

答案 0 :(得分:1)

将您的启动文件命名为

适用于iPad的

Default-Landscape.pngDefault-Landscape.png iPhone的Default.png' and默认@ 2x.png`。

请记住文件名区分大小写,因此请仔细检查