简体   繁体   English

Xcode 6设备方向分辨率不变

[英]Xcode 6 device orientation resolution not changing

I've made a Swift SpriteKit application within Xcode 6 and that was locked to landscape. 我在Xcode 6中制作了一个Swift SpriteKit应用程序,该应用程序被锁定为横向模式。 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. 例如,iPhone 4s模拟器在横向返回的分辨率为1024x768,但是在纵向显示时,仍返回相同的尺寸。 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. 我已经更改了应用程序和ViewController的部署信息,以反映所需的纵向方向。

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. 否则,无论是否旋转设备,场景大小都将保持不变。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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