0
votes

When I run my app in the simulator I don't get the correct screen resolution.

I query [[UIScreen mainScreen] bounds] when running in simulator in iPhone6 mode and get 1136x640 (after scale).

But iPhone6 resolution is 1334x750.

Choosing other target devices results in same problem.

How can I determine the correct screen size in simulator?

Using XCode Version 6.4 (6E35b)

Sample output from my console:

ios: scale=(2)
ios: before scale,    main.screen.size..................=(568,320)
ios: before scale,    main.screen.preferred.mode.size...=(640,1136)
ios: before scale,    application.frame.size............=(568,320)
ios: before scale,    current.mode.size.................=(640,1136)
2

2 Answers

0
votes

1136x640 is the resolution of an iPhone 5 or iPhone 5s. You are likely either running in a simulated iPhone 5, simulated iPhone 5s, or a newer phone in iPhone 5 compatibility mode due to your app not supporting iPhone 6 and iPhone 6 Plus screen sizes.

0
votes

I noticed that the fixed size that you're using for your storyboard is what is being read from xxx.frame.height and xxx.bound.height. So if you're using iPhone 5 as size in your simulated metrics, that's what is being read and not the simulator's size.

It's an annoying bug, and I haven't found any workarounds.