Forcing Orientation on individual Views

Hi

Is it possible to force specific orientation for individual views - so, of example, your iPhone will only view lists in Portrait, but when you view the detail, you can only view in Landscape?

Thanks

You can force orientation for the whole app, but I have never seen any app capable of forcing different orientations for each view.

Using declares it would be possible:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instm/UIViewController/supportedInterfaceOrientations

Thanks. I wonder is it possible to instantiate additional iosScreens?

[quote=221678:@Tom Iwaniec]Using declares it would be possible:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/index.html#//apple_ref/occ/instm/UIViewController/supportedInterfaceOrientations[/quote]

That may indeed be possible, although I wonder what that would do in term of user experience. It is already kind of strange when one holds a phone in landscape, and an app starts as portrait. I just imagine tapping on a button in Portrait, say, and all the sudden the next view is landscape while you hold the phone vertically. Odd …

Right there are probably only certain cases in which you should use it. A numpad/lock screen might be one, for example.

I agree that it should be avoided if possible, but there are cases where it’s acceptable - Netflix is one example that comes to mind

Right. I never use it on a phone but it does make sense.

Did anyone find a way to make this work since 2015?

Sort of. In the iPhone version of my app I lock the orientation as portrait as it wouldn’t make sense to allow the rotation given the nature of the app (though I allow rotation in the iPad version). However in one of my views – which is a camera view for taking photos – I want to allow rotation on iPhone so that users can take landscape photos if they wish. So I detect the rotation at the view level and then redraw the view, rotating buttons and changing the location of some things so that it works similarly to the native Camera app on the device.

I have a page which I only want in landscape, the rest only in portrait. I’ve used the example in the documentation which failed .