2013-03-08 76 views
0

在iOS中,駁回模態的視圖控制器(其被迫僅在縱向方向上顯示),如果該設備在橫向模式下,其中介紹了模態視圖沒有按控制器視圖控制器被保持後不能正確旋轉回景觀。iOS 6的橫向取向的問題

的「willAnimateRotationToInterfaceOrientation」方法被調用,所以我可以管理我的子視圖等的旋轉,但那麼實際的視圖控制器不旋轉爲橫向。所以我的子視圖看起來應該是橫向的,但界面是以縱向模式顯示的。

惱人的是,它在iOS 5的仿真工作正常。 IE瀏覽器。解除模態視圖控制器後,呈現視圖控制器旋轉回橫向。

任何人都經歷類似的東西,或有任何想法如何處理呢?

+1

在iOS 6中,您有管理'shouldAutorotate','supportedInterfaceOrientations'和'preferredInterfaceOrientationForPresentation'方向的新方法, – 2013-03-08 00:51:11

回答

0

對於IOS 6你需要用這種方法來處理方向。

- (BOOL)shouldAutorotate; { 
    return YES; 
} 

- (NSUInteger)supportedInterfaceOrientations; { 
    if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){ 
     return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); 
    } 
    else{ 
     return UIInterfaceOrientationMaskLandscape; 
    } 
} 

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation; { 
    if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){ 
     return UIInterfaceOrientationPortrait; 
    } 
    else{ 
     return UIInterfaceOrientationLandscapeLeft; 
    } 
}