2011-12-22 26 views
0

我在iPad應用程序中工作。我有4個圖像用於閃屏(風景右,左和縱向,縱向上下)。當我在縱向模式下啓動應用程序時,啓動屏幕顯示效果不錯,但它將方向更改爲Landscaper啓動屏幕不會更改其方向。你能告訴我任何想法嗎?今天我需要提交應用程序。請幫幫我。提前致謝。這裏是我的代碼,初始屏幕不會更改iPad中的方向?

-(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

名稱的飛濺文件作爲

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

記住文件名是區分大小寫的,因此請仔細檢查它們

+0

謝謝Mr.Saurabh。我已經命名這些來啓動屏幕Default-LandscapeLeft.png,Default-LandscapeLeft.png,Default-Portrait.png,Default-PortraitUpsideDown.png。這是正確的,還是我需要改變上面提到的名稱。請幫幫我。今天我需要提交應用程序。謝謝。 –

+0

再一次澄清。我有兩張橫向左右的圖像。我需要更改名稱。請幫幫我。 –

+0

只要按照我提到的名稱命名它,它應該可以工作! – Saurabh