草庐IT

scaleMode

全部标签

ios - Swift SKSpriteNode 位置 iPhone V iPad

我使用以下代码在我的应用程序View的左上角放置了一个节点:health=SKSpriteNode(color:.green,size:CGSize(width:progressValue,height:50))health.position=CGPoint(x:-self.frame.width/2,y:self.frame.height/2)这个位置在所有iPhone模拟器中都是正确的,范围从5到7Plus。但是,它不会出现在任何iPad模拟器中。我已将位置设置为midX和midY,它看起来很好,只是上面显示的代码不适合所有iPhone。我错过了什么?对于iPhone和iPad,是

ios - 使用 scaleMode .AspectFit 时如何更改 SKView 信箱颜色

我正在使用来自样板代码(新游戏iOS项目)的标准全屏SpriteKitView,以及我何时使用scene.scaleMode=.AspectFit为确保场景适合,剩余(信箱)区域用黑色着色。我试过这些选项来改变颜色:letskView=self.viewasSKView//washopingthisonewouldworkskView.backgroundColor=UIColor.redColor()//didn'texpectthiswouldwork,sincesceneisscaledanywaysscene.backgroundColor=SKColor.redColor()