2013-02-04 86 views
0

我有一個iPad應用程序,我需要它在加載過程中隨時加載ladnscapeLeft模式,在它可以旋轉並響應方向更改並轉到任何其他方向後。我怎麼能做到這一點? 我試着將plist.info文件改爲只有橫向左鍵,但是它鎖定了整個應用程序的生命週期。如何鎖定iPad的加載方向?

爲了澄清,應用程序應該只加載ladnscapeLeft,一旦加載完成,它可以響應其他方向。

+0

如果你的應用程序的其餘部分支持所有的方向,那麼你的加載屏幕也應該。加載過程中您無法支持肖像模式的原因是什麼? – Eric

回答

-1

您需要覆蓋UIViewController輪換事件。這裏有一個例子:

-(BOOL)shouldAutorotate 
{ 
    return YES; 
} 
-(NSUInteger)supportedInterfaceOrientations 
{ 
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    if (appDelegate.topViewController != nil) { 
     return [appDelegate.topViewController supportedInterfaceOrientations]; 
    } else { 
     return UIInterfaceOrientationMaskPortrait; 
    } 
} 
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
    if (appDelegate.topViewController != nil) { 
     return [appDelegate.topViewController preferredInterfaceOrientationForPresentation]; 
    } else { 
     return UIInterfaceOrientationPortrait; 
    } 
}