0

I have both landscape and portrait view in my app.

The problem :

I did the below code to lock portrait view

        override func shouldAutorotate() -> Bool {
    return false
}

override func supportedInterfaceOrientations() -> Int {
    return Int( UIInterfaceOrientationMask.Portrait.rawValue)
}

It display look like portrait view but give width and height same as landscape view.

In my case :

Portrait view : width , height = 1024.0,768.0 (same as landscape)

So i check using

    override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {

if toInterfaceOrientation == UIInterfaceOrientation.Portrait {
  //frame of Portrait 
   println("portrait")
}
else {
    //frame of Landscape  
   println("lanscape")
}}

It return landscape only but view looks like portrait.

I tried this also

            override func supportedInterfaceOrientations() -> Int {
    return  UIInterfaceOrientation.Portrait.rawValue    }

}

info.plist

enter image description here

Thanks in Advance

Stefan
  • 5,203
  • 8
  • 27
  • 51
Lydia
  • 2,017
  • 2
  • 18
  • 34
  • 1
    This may be a long shot and pure guessing, but are you running iOS 9? Interface Orientation management have changed in iOS 9 because of the support for multitasking. Have a look [here](https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/index.html) or [here](https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForSlideOverAndSplitView.html) for instance. Could that be why? – pbodsk Sep 12 '15 at 12:17
  • yes i think too did you know how to disable splitview – Lydia Sep 14 '15 at 05:37
  • Fortunately someone else has had that problem too :-) Maybe [this question and answer](http://stackoverflow.com/questions/30765157/is-it-possible-to-opt-your-ipad-app-out-of-multitasking-on-ios-9) can help you. – pbodsk Sep 14 '15 at 08:54

0 Answers0