簡體   English   中英

單視圖iOS 6的方向問題

[英]orientation issue for a single view iOS 6

我的應用程序中有7個視圖控制器,它們都處於縱向模式。 現在,我需要顯示另一個支持兩個方向的視圖(第8個視圖)。 我已經實現了這三種方法,但是屏幕不在橫向模式下旋轉。 請給我建議。

 - (BOOL)shouldAutorotate{
    return YES;
 }

 - (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAllButUpsideDown;
 }

 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationMaskAllButUpsideDown;
 }

您必須在appDelegate中實現以下功能:

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {    

return self.rotateToLandScape ?
    UIInterfaceOrientationMaskAllButUpsideDown :
    UIInterfaceOrientationMaskPortrait;

}

那么您應該在第8個屏幕中將self.rotateToLandScape設置為true。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM