2010-12-08 127 views
0

我正在構建應用程序,即使旋轉,我也希望它僅適用於風景。 閱讀身邊後,我已經設置了代碼艾琳這樣的:僅iPad風景(左側或右側)

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

這工作,但我想的界面旋轉,但始終處於橫向模式只與左或右的主頁按鈕,像其他許多應用程序...

如何得到它?

回答

3

試試這個:

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

太棒了,非常感謝! – Antonio 2010-12-08 02:50:35

1

你非常接近,只需要支持全部風景取向,最容易使用宏觀UIInterfaceOrientationIsLandscape完成。

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