2012-09-13 42 views
1

我在iOS 5中手動更改方向,一切正常。但在iOS 6中,鍵盤未改變方向.UIApplication statusBarOrientation不起作用。相反在iOS 6中手動更改方向

- (UIInterfaceOrientationMask)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskLandscape; 
} 

這個:

回答

2

試試這個

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

UPDATE:

在iOS系統7 SDK &的Xcode 5:

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskLandscape; 
} 
0

方法statusBarOrientation僅在supportedInterfaceOrientations回調返回0時有效。要使您的上一個代碼正常工作,可以在調用statusBarOrientation方法之前將標誌設置爲true。一旦調用statusBarOrientation,該標誌就可以重置。

當您發現此標誌爲true時,您可以從supportedInterfaceOrientations返回0。