如何检测iPhone 6& 6 Plus以编程方式查看模式 [英] How to detect iPhone 6 & 6 Plus View Mode Programmatically

查看:123
本文介绍了如何检测iPhone 6& 6 Plus以编程方式查看模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式识别查看模式(在设置>显示和亮度)?

Is there any way to identify View Mode( In setting > Display & Brightness ) programmatically ?

许多应用程序设计在标准模式和缩放模式下的行为都不同。

Many apps design are behaving differently in Standard Mode and Zoomed Mode.

请参考图片:

任何帮助将不胜感激。 :)

Any Help would be appreciated. :)

推荐答案

您可以使用 [UIScreen mainScreen] .nativeScale 如果正常,女巫将给你 2.6f ,如果放大iPhone 6 plus或定义的宏, 2.8f :

You can use either [UIScreen mainScreen].nativeScale witch will gives you 2.6f if normal, and 2.8f if zoomed on iPhone 6 plus, or the defined macros :

#define IS_OS_8_OR_LATER    ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && ([[UIScreen mainScreen] bounds].size.height == 568.0) && ((IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale) || !IS_OS_8_OR_LATER))
#define IS_STANDARD_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0  && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale == [UIScreen mainScreen].scale)
#define IS_ZOOMED_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0 && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale > [UIScreen mainScreen].scale)
#define IS_STANDARD_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)
#define IS_ZOOMED_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0 && IS_OS_8_OR_LATER && [UIScreen mainScreen].nativeScale < [UIScreen mainScreen].scale)

这篇关于如何检测iPhone 6&amp; 6 Plus以编程方式查看模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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