I've created a container view controller in which I can embed a child view controller (using the new iOS 5 API). When a child view controller is embedded that only supports the portrait orientation, and the device is currently in landscape orientation, I want to force a rotation to portrait.
I found the [UIViewController attemptRotationToDeviceOrientation]
method which almost does this, but not quite. It actually works the opposite way, so that if the child view controller is embedded, and the device is in portrait orientation, I can rotate to landscape (but the view controller will remain portrait), then dismiss the embedded view controller, and it will automatically rotate to landscape.
Is there any way to force the container view controller to rotate when embedding a child view controller that doesn't support the current orientation?
[UIViewController attemptRotationToDeviceOrientation]
while in an orientation that does not match the device orientation. – Hilton Campbell