场景没有完全填满屏幕
问题描述:
所以我工作的一个精灵套件游戏和didContactBegin,我有:场景没有完全填满屏幕
SKScene* myScene =[[GameScene alloc]initWithSize:self.size];
SKTransition* reveal = [SKTransition doorwayWithDuration:.5];
reveal.pausesIncomingScene = YES;
[self.view presentScene:myScene transition:reveal];
这工作几乎是完美的,除了它确实不是事实完全填满屏幕,就像它在第一次运行时一样,一切缩小一点。 x轴完全填充,但顶部和底部似乎略有缺失。
它为什么不一样?它是相同的代码,所以它不应该做同样的事情?谢谢!
答
你需要为你做现场设置的缩放模式时,第一次加载视图控制器:
SKScene* myScene =[[GameScene alloc]initWithSize:self.size];
myScene.scaleMode = SKSceneScaleModeAspectFill; // Use here the value you used in the view controller when creating the scene for the first time
真棒!它的工作非常感谢! – coal175