Xcode SpriteKit Game - How to configure the UI for multiple screen sizes during App install

狂风中的少年 提交于 2021-01-29 12:54:50

问题


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?


回答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



来源:https://stackoverflow.com/questions/58040836/xcode-spritekit-game-how-to-configure-the-ui-for-multiple-screen-sizes-during

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!