Looking at this question Detect if the device is iPhone X, I did the same code as there but I'm getting 560 for height and 320 for the width after running the code in a physical iPhone X in viewDidLoad
. I read that UIScreen
takes the device's display size. Any idea what could be causing this?
I made this code just to quick check the output.
- (void)viewDidAppear:(BOOL)animated {
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
NSLog([NSString stringWithFormat:@"%f", screenSize.height]);
NSLog([NSString stringWithFormat:@"%f", screenSize.width]);
NSLog(@"iPhone X");
}
Output:
560.000000
320.000000
iPhone X