2

Xcode 10.1 Swift 4.2

My blue iPhone XR used to report 414 x 896 for UIScreen.main.bounds

let screenSize = UIScreen.main.bounds
print(screenSize)
// (0.0, 0.0, 414.0, 896.0)

Now it reports 375.0, 812.0, which is the same size as the iPhone X.

let screenSize = UIScreen.main.bounds
print(screenSize)
// (0.0, 0.0, 375.0, 812.0)

This doesn't happen in the simulator (XR), only on the device. I've updated to latest iOS 12.1.1 and cleared build folder. Anyone have an idea what might be going on, or do I have a faulty phone?

skymook
  • 3,401
  • 35
  • 39
  • 1
    Are you using launch images? If so make sure that you provide launch images for all the needed screen sizes or use a launch screen file (storyboard) instead. – André Slotta Dec 12 '18 at 16:37
  • I am using a `LaunchScreen.storyboard`. It's not just an image. I'll look at this though, as it might be the cause somehow. – skymook Dec 13 '18 at 13:40

1 Answers1

3

Your phone has the display zoomed in.

Settings > Display

When you set the value to Standard, then you will see the expected values.

enter image description here

CodeBender
  • 35,668
  • 12
  • 125
  • 132