问题
I created my game using the Universal images of dimensions 1136x640 (@2x) and 2208x1242 (@3x) for my start background. I changed the scaleMode
property to .fill
for iPad
but it just fills the center with black borders all around. I thought .fill
was suppose to extend the width and height to fill the scene view.
I found a sample universal project that I tested and the images scaled with .fill
for the iPad. They used, 568x320 (@1x), 1136x640 (@2x) and 1704x960 (@3x) for their images. I copied the images into my project and tested for iPad
and still got the black surrounding.
What is causing the black border for the
iPad
?What explicit dimensions should I use for my universal game for
@1x
,@2x
,@3x
background so that when I setscaleMode
to.fill
foriPad
it will fill the scenes width and height?
Below is my how I set the StartBackgroundScene
scene in the GameViewController
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
let skView = self.view as? SKView
if skView?.scene == nil {
skView?.showsFPS = true
skView?.showsNodeCount = true
skView?.showsPhysics = false
skView?.ignoresSiblingOrder = false
let startBackgroundScene = StartBackgroundScene(size: skView!.bounds.size)
startBackgroundScene.scaleMode = .fill
skView?.presentScene(startBackgroundScene)
}
来源:https://stackoverflow.com/questions/40789050/scalemode-fill-not-filling-the-scene-view-on-ipad