How to determine if the iPhone 6+ (plus) is in Standard or Zoom mode

余生长醉 提交于 2019-12-31 06:04:52

问题


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
}

回答1:


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}.

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.




回答2:


//you can check it from here

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);


来源:https://stackoverflow.com/questions/26021903/how-to-determine-if-the-iphone-6-plus-is-in-standard-or-zoom-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!