I make application for Deployment target >= 7.1. And i see the "bug"... Application run in only landscape mode!
Code:
CGSize frameSize = [[UIScreen mainScreen] bounds].size;
In iOS 7 (iPhone 4), returned CGSize (width=320, height=480)
, but must returned 480x320
(Because run application in landscape mode).
In iOS 8 (iPhone 4S), returned CGSize (width=480, height=320)
- correct result.
The impression that iOS 7 returned frame without check landscape/portrait mode, and return size for portrait mode.
Thank.
The behavior changed in iOS 8.
Quoting UIScreen
documentation
Prior to iOS 8, a screen’s bounds rectangle always reflected the screen dimensions relative to a portrait-up orientation. Rotating the device to a landscape or upside-down orientation did not change the bounds. In iOS 8 and later, a screen’s bounds property takes the interface orientation of the screen into account. This behavior means that the bounds for a device in a portrait orientation may not be the same as the bounds for the device in a landscape orientation. Apps that rely on the screen dimensions can use the object in the fixedCoordinateSpace property as a fixed point of reference for any calculations they must make.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With