0

我在 iPad 应用程序中工作。我有 4 张用于启动画面的图像(横向右侧、左侧和纵向、纵向上下)。当我在纵向模式下启动应用程序时,启动画面看起来不错,但我将方向更改为 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];
    }   
}

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

4

1 回答 1

1

将您的启动文件命名为

Default-Landscape.pngDefault-Landscape.pngiPad
Default.png' andDefault@2x.png` 用于 iPhone。

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

于 2011-12-22T07:56:00.390 回答