2015-04-06 81 views
1

我在iOS 8的,後來在iPad上面臨的一個取向問題。我的應用程序需要iPad上的橫向右側和橫向左側方向。但它僅支持iOS 8中的iPad右側風景。如果嘗試更改方向,狀態欄的方向將發生變化,但應用程序的視圖控制器方向保持不變。我使用Xcode 6.2和Swift。我已經在plist中添加了所有方向,並且使用了func shouldAutorotate() - > Bool {} func supportedInterfaceOrientations() - > Int {}方法根據需求。請給我一個解決方案。提前致謝。定位問題的iPad與iOS 8

回答

0

我想有隻在iphone畫像和iPad的所有模式。覆蓋視圖控制器應該旋轉並沒有幫助我。研究發現,appdelegate可以處理輪換。請找到下面的代碼。希望它可以幫助你。

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow) -> Int { 

    var orientation = Int(UIInterfaceOrientationMask.Portrait.toRaw()) 

    if UIDevice.currentDevice().userInterfaceIdiom == .Pad { 
     orientation = Int(UIInterfaceOrientationMask.All.toRaw()) 
    } 
    return orientation 
}