The O.G. Virtual learning! Buy one, get 2 more Lifetime Memberships! - Click Here!

iPhoneX Support

Home 4 Forums Swift and Sprite Kit iPhoneX Support

This topic contains 1 reply, has 2 voices, and was last updated by  Justin 3 years, 7 months ago.

  • January 28, 2018 at 5:42 am #179227

    Do you have a tutorial on fitting all screen sizes especially the iphoneX in spritekit? and how do i go about doing it? i have used insets but they don’t seem to work properly i have a stack-overflow question explaining this here

  • January 28, 2018 at 4:58 pm #179244

    Looks like you’re testing for iOS11, but that’s not necessarily going to be the iPhone X, that could be any device running iOS11. This could test specifically for an iPhone X

     if (UIDevice.current.userInterfaceIdiom == .phone) {
                if (UIScreen.main.bounds.height == 812) {
                    print("iPhone X")

    So I’ve never actually used UIEdgeInsets before in a SpriteKit project (not sure if I’ve ever used them) so I can’t tell you much about that.

    I would do all my design in an SKS file. What you might find is that the layout of your buttons will be fine regardless of the phone.

    But if you do need to shift things slightly, you can still design everything in the SKS file, and using that code above, shift things up or down some for the X.

    Main takeaway here, I wouldn’t programmatically layout those menu buttons. Its just sooooo much easier to use an SKS file.

    Here’s a good video on how to do some device-specific testing before loading the SKS file. That way you can load a different menu file altogether for the iPhone, iPad, Apple TV or even the iPhone X.

You must be logged in to reply to this topic.

Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!

Uh oh, missing your affiliate ID. Create one real quick