how resize (and not automatically rescale) skview on orientation changed

464 Views Asked by At

I would like to rearrange the position of my nodes regarding to the orientation of the device.

Since the view has one dimension (defied in the .sks file) this one also dictates the actual view size independent of the iPhone is in portrait or landscape mode.

The "real" width and height can be obtained via self.view?.bounds but those do not always fit the defined size in the .sks fiele.

So my question is, is it possible to programmatically swap the width and height of those dimensions or do one need to create different views for portrait and landscape to guarantee the positions?

Thanks for all advices.

1

There are 1 best solutions below

0
On

The size you specify in the sks file is the size of the scene not the view. You can set your scene's scale mode to ResizeFill to force the scene size to always match your view size. This way no scaling will occur regardless of orientation.