0

I'm developing a basic game for IOS using SpriteKit. iPhone devices come in many shapes and colours. The former of which is giving me a bit of a headache. Different sized screens.

This is a two part question. Firstly

What solutions have other people implemented to achieve a uniform layout over multiple display sizes?

The current solution I'm looking at adopting is to find the device type as suggested in one of the solutions here Scale sprite kit game for all devices, I'll be implementing this through using Alessandro Ornano solution to the problem How to determine the current iPhone/device model?. Then changing the size and the position of game objects depending on device type.

Secondly:

Is it possible to have a function/method run only on application installation. Do apple allow this. If so where would I make the call to the method?

hoboBob
  • 832
  • 1
  • 17
  • 37

1 Answers1

1

1) This is 100% dependent on the actual game. You need to ask yourself what do you expect the experience to be for your user.

Sometimes, you can get away with showing more of the game. In this case, you develop with a square aspect ratio in mind.

Sometimes, you can get away with showing more from the top. In this case, you develop your game using the longest aspect ratio (iPhone X), but keeping your playable are in your shortest aspect ratio (iPad).

Sometimes, you need for everybody to have the same experience. In this case, you make your playable area the shortest aspect ratio, and you provide a fancy border around the playable area.

There is no need to detect what phone you are using. This is actually a bad approach when developing because you only focus on today, not tomorrow. A lot of people are kicking themselves when the X came out because they had to go in and update their app to accommodate it for the X.

2)Use the App Delegate

Knight0fDragon
  • 16,609
  • 2
  • 23
  • 44
  • Hi KoD thanks for the response, its give me something to mull over. With the call to a method only on install where in the appDelegate would you make the call. Is it in the application method?. – hoboBob Sep 21 '19 at 14:25
  • yes, you have an appDidFinish function where you could use UserDefaults to check if a certain flag exists. If the flag exists, then you know it is not a first time run. Otherwise, do your first time install and save the flag to UserDefaults to signal you are all setup. – Knight0fDragon Sep 21 '19 at 14:37
  • Ahhh ok yes I thought of doing something similar to this if its not possible to call a method during the initial. I planned to save a Bool in my persistent data model. Then check the value during each launch. It true run method and set to false. – hoboBob Sep 21 '19 at 14:55