I am trying to prevent a strange behavior in iOS 10 where an app that is designed only for landscape orientation comes back from background (to active) with apparently portrait orientation. The screen becomes heavily distorted (squeezed vertically). This happens only after pressing the power button of an iPhone (iPhone 6s is the only device I tested).
Normally the result of
[[UIScreen mainScreen] bounds]
= (CGRect) $7 = (origin = (x = 0, y = 0), size = (width = 568, height = 320))
But in some cases (not always) after a sequence "power button" -> "Home button" back to app (when done quickly <1s) the same value becomes:
(CGRect) $5 = (origin = (x = 0, y = 0), size = (width = 320, height = 568))
The problem resolves immediately after rotating the device to the opposite "landscape" orientation (flipping the iPhone upside down). The
mainScreen
bounds become back WxH => 568x320
I did not do much research. I do not really know where to start. Is this a known issue ?