UIScreen mainScreen bounds different between simulator and actual device on iOS8

363 views Asked by At

in my iOS7 app I use:

screenRect = [[UIScreen mainScreen] bounds];
screenWidth = screenRect.size.width;
screenHeight = screenRect.size.height;

I then use screenHeight for loading different view regarding if device is iPhone 4 or iPhone 5.

The main problem is, when I was checking the app for iOS 8 the simulator return exchanged values in landscape orientation so screenHeight vas actually screenWidth and it loads the wrong view. Ok I solved that, but we did not put any updates yet on App Store, because application is working just fine on actual device with iOS 8. It loads a proper view.

The actual device with iOS8 on landscape return values as before on iOS7, but on simulator iOS 8 the values are exchanged as they should be. Now it is very hard for me to decide if I put an update or not.

Does anybody know what is happening?

Thank you, Matej

1

There are 1 answers

0
Mallikarjuna SB On

Screen co-ordinates are now orientation based in iOS8. Review the session 214 from WWDC 2014 for more info: "View Controller Advancements in iOS 8"

Quote from the presentation:

UIScreen is now interface oriented:

  1. [UIScreen bounds] now interface-oriented
  2. [UIScreen applicationFrame] now interface-oriented
  3. Status bar frame notifications are interface-oriented
  4. Keyboard frame notifications are interface-oriented