While testing our current application we've run into an issue with the iPad pro. Our scenes our set up to be 1024x768 which works fine for iPad retina/non-retina and iPad mini. However on the iPad Pro, when transitioning to a scene, it will re-set the scene's size to 1366x1024. Now I know that the iPad Pro has a resolution of 2732x2048 (compared to 2048x1536 on the Air 2), but what I don't understand is why does the iPad Pro initially use the SKS view size, and then on first (and subsequent) transition(s) to another SKS, decide to change to try and match it's view size?
Consider the following. Both SceneA and SceneB are SKS files, each with a simple colored SKSpriteNode which takes up the full view (1024x768).
class SceneA: SKScene
{
override func didMoveToView(view: SKView)
{
print( "SceneA" )
print( self.size )
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
{
self.view!.presentScene( SceneB(fileNamed: "SceneB")! )
}
}class SceneB: SKScene
{
override func didMoveToView(view: SKView)
{
print( "SceneB" )
print( self.size )
}
}Runing this simple example, gives the following print out
SceneA
(1024.0, 768.0)
SceneB
(1366.0, 1024.0)I tried to manually set the view's size in GameViewController
skView.bounds.size = CGSizeMake(1024, 768)but this had no effect.
Of course one approach is to manually set the size of each Scene on load
self.size = CGSizeMake(1024, 768)which works fine for this simple example, but won't work when presenting subviews on the SKView.
class SceneB: SKScene
{
override func didMoveToView(view: SKView)
{
print( "SceneB" )
print( self.size )
self.size = CGSizeMake(1024, 768)
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
{
let scene = SceneC(fileNamed: "SceneC")!
let view = SKView(frame: CGRect(origin: CGPointZero, size: scene.size))
view.center = CGPointMake(self.size.width/2, self.size.height/2)
self.view!.addSubview(view)
view.presentScene(scene)
}
}where SceneC is a simple 512x384 SKS file consisting of a colored SKSpriteNode.
Anyone have any pointers?