1
votes

Is it possible that, in one view controller one view supports orientation while some do not.I mean suppose I have one MainViewController which contains two UIView say FirstView and SecondView.At a time only one view will be visible.Suppose First view supports both orientation while second view only supports portrait.When I launch second view when device orientation is landscape, it should launch in portrait not in landscape mode.But my problem is it is launching in landscape mode only.If it is possible then how I ca achieve this?

Thanks in advance!

1

1 Answers

0
votes

It is UIViewControllers that indicate support, or not, of orientations; it is not the job of UIViews.

Also, Apple's view controller framework assumes that a particular view controller will not change its mind about which orientations it supports during its lifetime.

So if you have two views that support different orientations, they need to be in different view controllers. You need to design your app in that direction if possible.

In iOS6 support has been added for UIViewController containment; i.e. you can have a UIViewController which is a 'container' controller which can present one or more different UIViewController's views inside itself. I'm not 100% sure on how this containment handles orientation changes of sub view controllers, but it's worth knowing about.