Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何确定iPhone 6+;(plus)处于标准或缩放模式_Ios_Iphone_Ios8 - Fatal编程技术网

Ios 如何确定iPhone 6+;(plus)处于标准或缩放模式

Ios 如何确定iPhone 6+;(plus)处于标准或缩放模式,ios,iphone,ios8,Ios,Iphone,Ios8,我试图确定iPhone 6+是处于标准模式还是缩放模式,但我找不到任何API来帮助确定这一点,到目前为止,唯一能指示手机处于哪种模式的是nativeScale if ([UIScreen mainScreen].nativeScale == 3.0) { // its in the simulator } else if ([UIScreen mainScreen].nativeScale == 2.880000) { // its an iPhone 6+ in zoom mo

我试图确定iPhone 6+是处于标准模式还是缩放模式,但我找不到任何API来帮助确定这一点,到目前为止,唯一能指示手机处于哪种模式的是
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
}

只检查屏幕的
边界
(而不是
本地边界
)怎么样?IIRC,在缩放模式下,边界为
{375667}
,但在常规模式下,边界为
{414736}


但是,是的,正如评论中提到的。。如果您使用的是AutoLayout,您的应用程序应该“只是”能够正确地自我调整,您不需要知道。

//您可以从这里查看它

CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
    NSLog(@"screnn width is ----<%f",screenWidth);



                       or


self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];


NSLog(@"screnn width is ----<%f",self.window.frame.size.width);
NSLog(@"screnn width is ----<%f",[[UIScreen mainScreen] bounds].size.height);
CGFloat screenWidth=[UIScreen mainScreen].bounds.size.width;

NSLog(@"screnn width是----你不需要知道。缩放模式只会使用你在iPhone 5s上的布局。但是使用刻度有什么问题吗?使用刻度没有什么严重的问题,只是感觉有点“裤子的座位”,我更喜欢有更严格的方式来判断。@AaronBrager在缩放模式下它的行为更像6而不是5SIn理论I 100%的人认为使用自动布局和编码进行自适应布局是可行的,在现有的代码库中,有时你必须做出一些不太吸引人的决定:)