Multiple MODAL VIEW controller change base modal to FULL SCREEN after ROTATION - ipad

This has been troubling me for quite a while, and I have done so much research on this, but could't find an answer. My first time posting a question here, please correct/forgive me if I make a mistake.
Environment: iPad, iOS 6.0
Problem: Base modal view change to full screen after rotation.
Description: I have a full screen application running currently showing a modal view controller. From the showing modal view, I display another modal view by doing:
vc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:vc animated:YES];
//[self presentViewController:vc animated:YES completion:NULL];
While the second view is appearing, and I rotate the iPad device. The base(first) modal view becomes full screen, and the topmost(second) modal view stays in formSheet style. (rotate correctly)
I can fix this by adding modal view to navigationController, but I want to keep it in modal view.
Any one knows a fix? I believe this person here is having the same problem:
ios 6 Incorrect modal view size after rotation
Btw, everything works fine in iOS 5. Apple changed the way rotation works in iOS 6.
Thanks,
-peter

I found a solution for this problem. Set the last modal view's presentation style to UIModalPresentationCurrentContext before you present it.
Like this:
vc.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:vc animated:YES];
This solves the base modal view change size after rotate the iPad screen.
Originally answered by people on Apple Dev forum.

I had the exact same issue and used the code in iOS 6: Parent modal's modalPresentationStyle ignored after rotation worked like a charm

Related

Presenting UIViewController causes strange behaviour

When presenting a UIViewController using
[myUINavigationController presentViewController: paypalViewController animated:YES completion:nil];
The new controller displays fine, but when it is dismissed the navigation breaks in the whole app. Pushing screens after this point using 'pushViewController' seems to push the view because I can 'click' buttons on the screen, but the UI itself does not update.
The strange thing is, that presenting the view as above does work from certain screens but not others. I have tried setting the UINavigationController on the screens that don't work to a strong variable, but that didn't work either.
Any ideas?

How to have a view in ipad just like Appstore

I want to have a view in my application to be displayed just like app store showing application.
I mean a view in middle of page, smaller than iPad actual size, and the rest of view is dimmed.
just like this:
should i use modal or what?
Thanks.
From code:
myViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:myViewController animated:YES completion:nil];
If you use storyboard you can also set modal segue with FormSheet style.

How do I present modal view as form sheet directly without any animation

How do I present modal view as form sheet directly without any animation?
When I present the modal view, if it's portrait, it always come down from upper left corner, and if it is in landscape, it always come out as portrait and rotate to landscape mode(it takes about 0.2 second, quick but not pretty).
Anybody knows what is this problem? It bothers me. (I try it in a new project, it works fine, it came out directly(not from left upper corner, without rotation in landscape mode)
Help!!
Thanks
try this
viewController.modalTransitionStyle = nil;
[self presentViewController:viewController animated:NO completion:nil];
Can we see your code calling the modal view? I assume you have already added the animated tag
... presentModalViewController: YOURCONTROLLER animated: NO];

Presented views on iOS 6 disappear. How do I fix this?

I have two views that I present from a view controller: one for settings, one for a device log. When I run the app on an iPad and present the view, then rotate the device, the view disappears.
If I present the view (using a button) in portrait (either one) and rotate it, it disappears. If I then present the view again, it reappears, and then rotates correctly.
Why does this happen? What can I do to fix it?
Thanks for any responses.
UPDATE: This only occurs if I first present the view in portrait mode. If I present it in landscape mode first, it rotates just fine and doesn't disappear.
In my master view controller's viewDidLoad:
self.logViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"LogViewController"];
[self.logViewController setModalInPopover:YES];
[self.logViewController setModalPresentationStyle:UIModalPresentationFormSheet];
[self.logViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
My method called when the Log button is pressed:
- (void)showInfoView:(id)sender
{
[self presentViewController:self.logViewController animated:YES completion:NULL];
}
I have realized what I was doing wrong. I was presenting the presented view controller from my Master view in a SplitViewController. By presenting it from the Detail view, the problem was solved.

iPad Full Screen Modal View over TabBarController?

On a TabBar-based application on the iPad, is there a way to present a modal on top of it in "FullScreen"?
I have a LANDSCAPE ONLY APP (if that makes a difference) and the item I want to currently present modally I would like to present full screen, filling the entire screen just to clarify. I can present it in "PageSheet" fine, and "FormSheet" is all right, after a few button adjustments on the modal view nib, but once I try "FullScreen", the background goes white (TabBar still there, though), and if I retry hitting the button (without restarting the simulator), it won't respond.
The view where the button is located to present the modal view is CountryViewController.m and has the action:
-(IBAction) showNewModal:(id)sender {
modalContent.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
modalContent.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:modalContent animated:YES];
}
This code works fine without the TabBar, I've realized. I've looked for hours for something to add to this code or even in the AppDelegate.h and .m files but so far, it's either unresponsive (oddly enough without showing an error) or the aforementioned white space.
in my experience the problem comes from presenting the modal from the wrong controller.
[self.tabBarController presentModalViewController:modalContent animated:YES];
should work
If you work with iOS 4 a (maybe) beter options is to use:
[[UIApplication sharedApplication].keyWindow.rootViewController presentModalViewController:modalContent animated:YES];

Resources