12

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.

Please refer image :

enter image description here

Any Help would be appreciated. :)

Nico
  • 1,788
  • 2
  • 23
  • 41
  • See my response for the similar question [here](https://stackoverflow.com/a/65844985/8314394). It is not using hardcoded heights and is more useful for any device size. – Starsky Jan 22 '21 at 12:22

2 Answers2

21

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)
Loegic
  • 3,390
  • 20
  • 33
0

I was facing same issue when I install Application in 2 types of devices iPhone 6 (Standard mode) and iPhone 6 (Zoom mode) but later on I try to catch the height and width of the iPhone when it launch.

in your ViewController.h class in viewDidLoadmethod try to check the height and width in console.

NSLog(@"width %f, height %f",self.view.frame.size.width,self.view.frame.size.height);

By checking this you can get difference between Standard and Zoom mode.

From the Vizllx answer u can also check like below what I tried.

UIScreen *MainScreen = [UIScreen mainScreen];
UIScreenMode *ScreenMode = [MainScreen currentMode];
CGSize Size = [ScreenMode size];
NSLog(@"width %f, height %f",Size.width,Size.height);

Thanks.

alex
  • 518
  • 3
  • 10