[英]Wrong screen resolution for iPhone6 in iPhone Simulator
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). 我在iPhone6模式下的模拟器中运行时查询[[UIScreen mainScreen]边界],并得到1136x640(缩放后)。
But iPhone6 resolution is 1334x750. 但是iPhone6的分辨率是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) 使用XCode版本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)
1136x640 is the resolution of an iPhone 5 or iPhone 5s. 1136x640是iPhone 5或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.
由于您的应用不支持iPhone 6和iPhone 6 Plus屏幕尺寸,您可能在模拟iPhone 5,模拟iPhone 5s或更新的手机中以iPhone 5兼容模式运行。
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 . 我注意到,您用于情节提要的固定大小是从xxx.frame.height和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.
因此,如果您在模拟指标中使用iPhone 5作为尺寸,那是读取的内容而不是模拟器的尺寸。
It's an annoying bug, and I haven't found any workarounds. 这是一个烦人的错误,我还没有找到任何解决方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.