How to change window orientation to landscape in Xcode 4 Interface Builder?

I appreciate that probably something is missing for me here, but ...

My iPad application only supports landscape mode and has a MainWindow.xib window that I would like to work in landscape mode in Xcode 4, however the drop-down menu to change this (Simulated Metrics → Orientation) is always grayed out.

I notice that Views can be rotated just fine, these are only Windows that cannot be rotated in Xcode 4 with this setting.

Is there a workaround for this, or do I need to place a top view of MainWindow to rotate it?

+6
source share
1 answer

I think this is because applications always run in portrait, and then rotate to the appropriate arrangements. From the UIViewController docs:

Note. At startup, applications should always customize their interface in portrait orientation. After application: didFinishLaunchingWithOptions: returns a method, the application uses the described rotation mechanism of the view controller above to rotate the views to the appropriate orientation before showing the window.

So you will need the magic of the UIViewController for simulated metrics to make sense. If you used the Window-based application template as a starting point for your project, try using the Application Based Viewer template instead.

+2
source

Source: https://habr.com/ru/post/889209/


All Articles