简体   繁体   中英

Xcode 6 device orientation resolution not changing

I've made a Swift SpriteKit application within Xcode 6 and that was locked to landscape. I've attempted to change the device orientation to portrait and the screen itself changes orientation but the resolutions do not swap.

For example, the iPhone 4s simulator is returning a resolution of 1024x768 in landscape, however when in portrait orientation, still returns the same dimensions. As such all graphics, fonts, etc are all skewed. I no longer need the application to support landscape view.

I have changed the deployment info of the app and the viewcontroller to reflect the desired portrait orientation.

This is just a guess, but are you changing the the size of your scene when you rotate your device?

    if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
        // Configure the view.
        scene.size = view.bounds.size // <- Here

        let skView = self.view as SKView
        skView.showsFPS = true
        skView.showsNodeCount = true
        skView.ignoresSiblingOrder = true
        scene.scaleMode = .ResizeFill 
        skView.presentScene(scene)
    } 

Otherwise your scene size will remain the same regardless of whether your rotate your device or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM