如何确定iPhone 6+(plus)是处于标准模式还是缩放模式 [英] How to determine if the iPhone 6+ (plus) is in Standard or Zoom mode

查看:309
本文介绍了如何确定iPhone 6+(plus)是处于标准模式还是缩放模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定iPhone 6+是处于标准模式还是缩放模式,我找不到任何有助于确定这一点的API,到目前为止,唯一指出手机所处模式的是 nativeScale

I'm trying to determine if the iPhone 6+ is in standard or zoom mode and I can't find any API's that help determine this, so far the only thing that is indicating which mode the phone is in is the nativeScale

if ([UIScreen mainScreen].nativeScale == 3.0) {
    // its in the simulator
} else if ([UIScreen mainScreen].nativeScale == 2.880000) {
    // its an iPhone 6+ in zoom mode
} else if ([UIScreen mainScreen].nativeScale == 2.6086956521739131) {
    // its an iPhone 6+ in standard mode
}


推荐答案

如何检查界限(不是 nativeBounds )的屏幕? IIRC,在缩放模式下,界限将 {375,667} 但在常规模式下,它们是 {414,736}

How about just checking the bounds (not nativeBounds) of the screen? IIRC, in zoom mode the bounds will be {375, 667} but in regular mode they are {414, 736}.

但是,正如评论中所提到的..如果您使用的是AutoLayout,您的应用应该只是能够正确调整自己而且您不应该需要知道。

But yes, as mentioned in the comments.. if you are using AutoLayout, your app should "just" be able to adjust itself correctly and you shouldn't need to know.

这篇关于如何确定iPhone 6+(plus)是处于标准模式还是缩放模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆