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 }
}
Thanks in Advance