skip to Main Content

UIScreen.main.bounds.width and UIScreen.main.bounds.height are both wrong. It’s returning 414×736 but it should be about 360×640.
Device: iPhone 8 Plus.

2

Answers


  1. It depends on when you call the function.

    You have to call this after View Appear fully.

    override func viewDidLoad() { // Or viewDidAppear()
    {
        let frame = self.view.bounds; // or UIScreen.main.bounds also works
    }
    

    You will get different value if you call the function on viewWillAppear.

    Login or Signup to reply.
  2. iPhone [Any] Plus native rendering resolutions are downsampled by ÷1.15 because screens didn’t have enough pixels to show @3x until iPhone X arrived.

    Screen resolution is 360×640 physical points but screen rendering is 414×736 software points. That only happens on Plus models.

    414 ÷ 1.15 = 360
    736 ÷ 1.15 = 640
    

    Check out this: https://www.paintcodeapp.com/news/iphone-6-screens-demystified

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search