I am detecting the device orientation with these lines of code:
UIDevice.currentDevice().orientation.isPortrait.boolValue
UIDevice.currentDevice().orientation.isLandscape.boolValue
And I detect check if it's an iPad with this code:
userInterfaceIdiom == .Pad
I used this code in commonInit()
function which is called in the Init()
function. When I execute my code on iPad the two first lines return both false
which is not correct, one of them should be true
. The third line is working fine.
If I use the code in other functions, such as supportedInterfaceOrientations()
, it works fine. Do you know what could be the problem?