views:

124

answers:

0

I am presenting MFMailComposeViewController as modal from a view controller (lets call it xyz) added to nav stack. When user clicks on cancel button, the MFMailComposeViewController is dismissed. This works fine when xyz is added to nav stack in portrait/landscape mode and the device orientation doesn't change until after cancel is clicked.

present modal - alloc init MFMailComposeViewController on a button tap

[self.navigationController presentModalViewController:mailController animated:NO];

dismiss modal - mailComposeController: didFinishWithResult: error

[self.navigationController dismissModalViewControllerAnimated:YES];

If orientation changes between xyz being displayed and the mail view controller canceled, xyz's orientation changes unexpectedly.

For example: step 1- Device orientation portrait
step 2- pushViewController xyz on button tap
step 3- change device orientation to landscape, all views are rotated as expected
step 4- present MFMailComposeViewController
step 5- mail controller displayed on landscape mode
step 6 - tap on cancel or send email
step 7 - xyz orientation rotated 90 degrees (unexpected) - expected: xyz orientaion shouldn't change.

I don't know whats going on. Any help is appreciated.