Question

I have a detail view where i load a help view with a button. I am using [UIViewController presentModalViewController:animated:]. In help view I am dismissing the view with a button. I am using [UIViewController dismissModalViewControllerAnimated:].

The problem is, after dismissing the help view, the detail view is in portrait mode, regardless of which orientation the device is in.

In all the view controllers, I have implemented shouldAutoRotateToInterfaceOrientation: and returned YES.

Was it helpful?

Solution

I think there are two selective solution

1.Officially available in iOS 5.0 and later, you can implement

/* call this method when your return value from shouldAutorotateToInterfaceOrientation: changes
 if the current interface orientation does not match the current device orientation, a rotation may occur provided all relevant view controllers now return YES from shouldAutorotateToInterfaceOrientation: */

+ (void)attemptRotationToDeviceOrientation

See also : http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html

2.Use the trick from Canopus's Answer. It's pretty fine with iOS 4.3 and earlier BUT It's not guarantee solution that owner answer has warned you.

Hope it helps you!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top