1
votes

I am facing an orientation issue in iOS 8 and later in iPad. My application requires both landscape right and landscape left orientations in iPad. But it supports only landscape right orientation in iPad with iOS 8. If you try to change the orientation , the orientation of status bar is getting changed, but the application's view controller orientation remains unchanged. I am using Xcode 6.2 and swift. I have added all orientations in plist and used func shouldAutorotate() -> Bool{} func supportedInterfaceOrientations() -> Int {} methods as per the requirement. Please give me a solution. Thanks in advance.

1

1 Answers

0
votes

I wanted to have only portrait in iphone and all modes in iPad. Overriding viewcontroller shouldrotate didn't help me out. With research found that , appdelegate can handle the rotation. Please find the below code.Hope it helps you.

    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
}