iPhoneX Support

Home 4 Forums Swift and Sprite Kit iPhoneX Support

This topic contains 1 reply, has 2 voices, and was last updated by  CartoonSmart 6 months, 3 weeks 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 https://stackoverflow.com/questions/48483786/spritekit-safearealayoutguide-not-finding-top

  • 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.

Download the new CartoonSmart TV App - Tons of FREE and Premium Lessons

It's Free Right? Sure, I'll Get It!