Search code examples
iosobjective-ciphoneios12

iPhone XR returns correct nativeBounds but has wrong screen size on device


My project target iOS - 11 and later. It has correct Launch images assets for XR and XS Max with appropriate dimensions. On simulator my app works as expected on both XR and XS Max.

But, users reported UI issues on real devices. After some research it looks like on real device this

[UIScreen mainScreen].nativeBounds.size

returns correct values. But seems like device itself think that it has iPhone X screen size (like when i do not use correct launch screen images). And in my opinion it returns wrong values with

[UIScreen mainScreen].bounds.size

this one i believe returns values like it's not iPhone XR but iPhone X.

Did someone face such an issue too?


Solution

  • In my case the trouble was in the specific user device settings. Settings -> Display & brightness -> Display zoom switch to ON. This cause to return wrong

    [UIScreen mainScreen].bounds.size
    

    values runtime