As per the comment by Simon Jenkins, moving the layout code to viewWillLayoutSubviews()
instead of viewDidLoad()
solved the issue.
SKScene vertically squashed
-
05-10-2022 - |
문제
My SKScene is vertically squashed. I have added an SKEmitterNode, but this is clearly being squished and I have no idea why.
I have another emitter in another scene which is not doing this and all the code appears to be exactly the same.
Normal: (http://i.imgur.com/xL7GVvd.png)
Squashed: (http://i.imgur.com/O0xMeFC.png)
Edit:
The code is IDENTICAL for both.
// Configure the view.
SKView * skView = (SKView *)self.view;
// Create and configure the scene.
SKScene * scene = [MyScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
해결책 2
다른 팁
Your scaleMode
property seems off.
Try scene.scaleMode = SKSceneScaleModeAspectFill;
or scene.scaleMode = SKSceneScaleModeAspectFit;
depending on your requirements.
제휴하지 않습니다 StackOverflow