I wonder how I can check if the user has the display set to zoomed mode.
I have tried this:
public var isZoomed: Bool {
return UIScreen.main().scale < UIScreen.main().nativeScale
}
And also:
#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)
But I none of them works.
So is there a way to detect if the device is zoomed or even force it to not be zoomed when the app is running?
You can see larger onscreen controls on an iPhone with Display Zoom. Go to Settings > Display & Brightness > Display Zoom. Select Larger Text to make all the text on iPhone larger. Tap Done, then tap Use Zoomed.
What Apple does, when you select “Zoomed,” is they treat your iPhone as if it's a different model— one with a smaller screen, and fewer pixels. If you take the image that would have fit on a smaller screen, but you stretch it to fit a larger screen, everything is bigger. And that's how Zoomed works.
The main advantage of Display Zoom is that it applies to the entire screen evenly, enlarging everything uniformly. Unlike Dynamic Text, there is no distortion of the relative size of interface elements. Text is easier to read, UI elements are easier to touch. This latter point is frequently the more useful aspect.
Working swift 3 solution:
if (UIScreen.main.bounds.size.height == 667.0 && UIScreen.main.nativeScale < UIScreen.main.scale) {
print("iphone 6 plus")
} else {
print("none zoomed 6 plus")
}
if (UIScreen.main.bounds.size.height == 568.0 && UIScreen.main.nativeScale > UIScreen.main.scale) {
print("zoomed iphone 6")
} else {
print("none zoomed")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With