JustSomeoneWhoCodes
JustSomeoneWhoCodes

Reputation: 135

Resize element to fit screen size in spritekit

Obviously, you can use UIScreen to find the screen height/width to adjust the scene accordingly, but is there some way I can update all my SKSpriteNodes at once? I made a game with spritekit and only realized afterward, none of it was based on screen size, so it only works well on the iPhone 7 and 8. Is there some shorter code I can do instead of manually changing each size/location to be based on screen size?

Upvotes: 0

Views: 588

Answers (1)

JustSomeoneWhoCodes
JustSomeoneWhoCodes

Reputation: 135

I figured out a solution. I made a SpriteKit Scene in the storyboard and then constrained it to the Safe Area, which allowed aspectFill to work properly.

Upvotes: 1

Related Questions