0

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.

Ell Neal
  • 6,014
  • 2
  • 29
  • 54
brush51
  • 5,691
  • 6
  • 39
  • 73
  • do you want to support all orientations? Or landscape only? – pmk Feb 24 '12 at 13:47
  • sorry for late answer. i want to support all orientations – brush51 Mar 05 '12 at 15:31
  • I've already write the answer. If this answer help you, I'm glad to hear you accept it. – Sakares May 10 '12 at 09:23
  • i have tested it but doesnt worked for me. next time i will try that again and if i solve it or not, i will tell you. actually i have other important things to solve first. – brush51 May 10 '12 at 10:07

1 Answers1

1

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!

Community
  • 1
  • 1
Sakares
  • 606
  • 12
  • 31