1

我想在我的應用程序中至少有iOS6。我試圖用Mono提供的示例項目創建一個tabbar應用程序。我試圖刪除ShouldAutorotateToInterfaceOrientation方法和Monotouch Only風景iOS6

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() 
{ 
    return UIInterfaceOrientationMask.Landscape; 
} 

我做了兩個視圖控制器取代了它,但方向還是人像。我也嘗試覆蓋ShouldAutorotate並返回true,但也沒有幫助。我必須做什麼,我的應用程序只能在橫向模式下使用?

我也嘗試將部署目標設置爲iOS6,但我只能在下拉列表中切換至5.1。

有什麼建議嗎?

編輯: 我的裝置的東西是完全錯誤的。因爲我無法選擇ios6作爲部署目標,所以沒有任何工作。新的乾淨安裝後,一切正常。

+0

提供您系統的所有版本信息。您可以從「MonoDevelop」菜單,「關於MonoDevelop」項目,「版本信息」選項卡中獲取它們。點擊「複製版本信息」按鈕並編輯/粘貼到你的問題。 – poupou

回答

2

像@svn說Info.plist狀態,其方位您的應用程序的支持。這可以通過覆蓋GetSupportedInterfaceOrientations進一步定製(例如限制)。

但也有(iOS 6中的新增功能)PreferredInterfaceOrientationForPresentation哪些可以(也應該)覆蓋。

Apple documentation中提供了更多詳細信息,包括iOS6特定功能。

我也嘗試將部署目標設置爲iOS6,但我只能在下拉列表中切換到5.1。

這聽起來像你使用的Xcode沒有6.0 SDK。看看我對你的問題的評論,關於如何檢查MonoDevelop使用什麼來構建你的應用程序。

+0

感謝您的幫助。它很奇怪,因爲我有6.0的SDK。但我猜想有些事情是真的錯了 - 即時安裝新的東西,然後再試一次。可能這會解決我的問題。我會給你反饋。 – NDY

+0

問題解決了。現在我可以在MonoDevelop中選擇6.0,並且僅限景觀模式工作2。 – NDY

1

你也應該選擇支持的設備取向中的Info.plist

+0

我也做到了。 – NDY

1

對於iOS 5和iOS 6的支持,你應該這樣做, 可悲的是「GetSupportedInterfaceOrientations」有問題,至少對我的模態!

//iOS 6 support 
    public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations() 
    { 
     return base.GetSupportedInterfaceOrientations(); 
    } 

    //iOS 5 support 
    //if I don't put it it doesn't work for iOS 5 device but works on iOS 6 simulator 
    [Obsolete ("Deprecated in iOS6. Replace it with both GetSupportedInterfaceOrientations and PreferredInterfaceOrientationForPresentation")] 
    public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) 
    { 
     return true; 
    } 

確定項目屬性爲優先。