2011-05-30 103 views
0

我正在開發基於窗口的iPhone應用程序。 我想通過增加旋轉功能,基於iPhone的旋轉窗口應用程序

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
// Return YES for supported orientations 
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 
} 

,但它不工作。 這有什麼問題。

注意:xCode 4,iOS 4.3

問候。

+0

你在哪裏添加了這個方法?應用程序委託或自定義視圖控制器? – 2011-05-30 21:10:46

+0

默認情況下,此方法添加到視圖控制器中。 – mannan 2011-05-31 11:15:39

+0

您是如何從應用程序代理加載視圖控制器的? – 2011-05-31 11:22:41

回答

0

在Xcode 4中,點擊左側欄中最頂端的項目,然後點擊摘要選項卡,並確保支持的方向設置正確。

如果是罰款,那麼你可以嘗試重寫回線是這樣的:

return(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); 

如果不工作只是嘗試return YES;,看看景色會旋轉。

+0

我已經試過返回YES;但那也行不通。 – mannan 2011-05-30 19:28:53

+0

實際的問題是,上述方法適用於基於View的應用程序,但它不適用於基於Window的應用程序。 – mannan 2011-05-30 19:32:18

相關問題