SpriteKit scene screen offset on iOS9 / Xcode7

2019-02-28 12:01发布

I moved a SpriteKit project from Xcode64 to Xcode7, ran it in a iOS9 simulator and the screen content is shifted. (It is not shifted when running in iOS8 simulator.)

iOS9 Simulator screenshot:

enter image description here

Zooming the SpriteKit scene in Xcode7 scales the frame and the content with different centers. When the scene is not zoomed out or in, it looks perfect; but with zoom out it looks like this: (note how the yellow frame is not aligned with the node anymore)

Xcode 7 scene zoomed out screenshot:

enter image description here

I created a new scene to see which details differ.

Scene in Xcode - first bad - second good:

enter image description here

enter image description here

Node in Xcode - first bad - second good:

enter image description here

enter image description here

Note how the anchor points of the scenes and the positions of the nodes are differing between the good and the bad version.

I can manually change the bad values to reflect the good values. This will involve moving 20 to 30 nodes. I would like to move these nodes exactly - say - by (384,512). However, just using the mouse they will end up at some fraction position (212.561 instead of 212).

Question 1:

Can I move a group of selected nodes by a specific number of points in Xcode7?

Or: Are there "guidelines" to which I could "snap"?

Question 2:

Can I import / export / save as / ... the scene, so that "things are good"?

(Zooming in Xcode6.4 kept the yellow frame and the nodes aligned. Now in Xcode7 I'd like to import the scene in a way, that again zooming will keep the yellow frame and the node aligned - in a hope that this would also solve the scene offset in the iOS9 simulator screen.)

1条回答
迷人小祖宗
2楼-- · 2019-02-28 12:42

With the release of Xcode 7.2 the issue can be fixed by opening each scene file (.sks) and saving it once. The yellow frame and the content (see the screenshots in my question) are again aligned nicely to another when zooming in and out.

查看更多
登录 后发表回答