Domanda

I have read multiple QAs on this topic and read the documentation, but I would like some confirmation on the answers.


- (BOOL)shouldAutorotate 

This method determines if the VC is allowed to autorotate?


-(NSUInteger)supportedInterfaceOrientations

This method determines what orientations the specific View Controller accepts, is able to rotate too...


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 

This method determines what the preferred orientation is for. However, it is not called on the VC but on a navigation controller. So if you wish to use you should subclass uinavigationcontroller.


Is this all correct?

What I am trying to do is have one specific controller auto rotate to landscape if an image is passed to it in that orientation. I can get the image orientation without an issue. I have set the shouldAutorotate to YES on that VC, and the supportedInterfaceOrientations is set to all. However it does not rotate.

This is from a UINavigationController that modally presents another UINavigationController on top of it and is the specific controller is about 6th in the stack.

How do I control the preferred orientation for a VC within a UINavigationController which is determined by a value from that View Controller? As the orientation would not always be the same.

È stato utile?

Soluzione

Be careful you don't have orientation lock on the device whilst testing!!! Opps

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top