IPAD – Multiple MODAL View controllers Change the basic modality to Full Screen after rotation

This has troubled me for a long time. I did a lot of research on this, but I couldn’t find the answer. I’m posting a question here for the first time, if I make a mistake, Please correct/forgive me.

Environment: iPad, iOS 6.0

Problem: The basic modal view changes to full screen after rotation.

Description: I have a full screen application running and currently displaying a modal view controller. From the display mode view, I display another modal view by doing the following:

vc .modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:vc animated:YES];
//[self presentViewController:vc animated:YES completion:NULL];

When the second view When it appears, I rotate the iPad device. The basic (first) modal view becomes full screen, and the topmost (second) modal view maintains the formSheet style. (Correct rotation)

I can add to the navigationController Modal view to solve this problem, but I want to save it in the modal view.

Anyone knows the fix? I believe people here have the same problem:
ios 6 Incorrect modal view size after rotation

By the way, everything is normal in iOS 5. Apple changed the way of rotation in iOS 6.< br>Thank you,
-Peter

I found a solution to this problem. In the presentation Before, set the presentation style of the last modal view to UIModalPresentationCurrentContext.

Like this:

vc.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController: vc animated :YES];

This can solve the basic modal view change size after rotating the iPad screen.

Initially answered by people in the Apple Dev forum.

This has troubled me for a long time. I did a lot of research on this, but I couldn’t find the answer. I am posting a question here for the first time, if I am mistaken, please correct/ Forgive me.

Environment: iPad, iOS 6.0

Question: The basic modal view changes to full screen after rotation.

Description: I have one The full-screen application is running and the modal view controller is currently displayed. From the display modal view, I display another modal view by doing the following:

vc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:vc animated:YES];
//[self presentViewController:vc animated:YES completion:NULL];

When the second view appears, I rotate the iPad device. The basic (first) modal view becomes full screen, and the topmost (second) modal view maintains the formSheet style. (Correctly rotated)

I can add a modal view to the navigationController To solve this problem, but I hope Save it in the modal view.

Anyone knows a fix? I believe people here have the same problem:
ios 6 Incorrect modal view size after rotation

By the way, everything is normal in iOS 5. Apple changed the way of rotation in iOS 6.< br>Thank you,
-Peter

I found a solution to this problem. Before rendering, set the presentation style of the last modal view For UIModalPresentationCurrentContext.

Like this:

vc.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:vc animated:YES];

This The basic modal view change size can be solved after rotating the iPad screen.

It was originally answered by people in the Apple Dev forum.

Leave a Comment

Your email address will not be published.