iPhone X resolution

This topic contains 2 replies, has 2 voices, and was last updated by  Angel Arcas 11 months ago.

  • December 18, 2017 at 5:21 pm #177456

    Hello,
    I am creating an iPhone app.
    I want to use the same scene for both device (iPhone X – iPhone 8 Plus/iPhone 8) to avoid letterboxing or cropping
    Is there any way to set a different camera for the iPhone X or iPhone 8?
    Do I need to add @2x and @3x images?
    Thanks in advance!

  • December 19, 2017 at 3:59 pm #177491

    Well, you wouldn’t want to use different images. You should be using the 2x and 3x sizes anyway.

    You could choose a different camera, but the issue there is that the camera is always the size of the Scene. So you either have to make a separate iPhoneX sized Scene or change the scale of the camera. Changing the scale of the camera is far easier. Something like this would work….

     if (UIDevice.current.userInterfaceIdiom == .phone) {
                if (UIScreen.main.bounds.height == 812) {
                    
                    print("iPhone X")
                    self.camera?.xScale = 1.2 //tinker with that number, 0.8 might work better
                    self.camera?.yScale = self.camera?.xScale
      
                }
               
                
            }

    Try pasting that in at the end of your didMove(to:) function in the main Page.swift class.

    That’s one option. I would probably keep sizing my SKS files for the iPhone 8 dimensions, but in scene I would included images that exceed the height by 20% (if your app is in portrait mode) or exceed the normal width (if your app is in landscape mode). So if the content spills out a bit, that’s what will show on the iPhoneX.

  • December 21, 2017 at 12:09 pm #177569

    Hi Justin, thanks for you reply! I followed your advice about exceed the background image 20% and every images fits ok! No more stretched illustrations! Thanks again!

You must be logged in to reply to this topic.