iPad Full Screen Modal View over TabBarController? - ios

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];

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?

Dismiss multiple view controllers at once (iOS 8)

So in my code, I have a Tab Bar controller. When you click one of the tabs, it calls this code to open up a new storyboard (for video capture).
NavController *NC = [[NavController alloc] initWithCaptureInput];
[self presentViewController:NC animated:YES completion:nil];
In this view, he records a video and then the storyboard presents the segue. In that view, the user can preview his video. When he click's a button the storyboard pushes him to the next view.
In that last view, I use to call this in iOS 7 to make the app go back to the initial view (before the current storyboard).
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
This worked fine but in iOS 8, the top view is dismissed, and during the animation, you see the video preview view. Its only when the animation is done that the video preview view is removed (as it should be).
Can anyone tell me how I can have my proper animation where the top view is removed and during the animation you only see the initial view? This could be done if the app was to remove all the views at the same time (animating them at the same time too).
Yes, I've noticed that behavior, too. Unwind segues (as described in Technical Note TN2298) appear to handle this more gracefully.
In the view controller that you want to unwind to, add a method that looks like:
// use whatever name most descriptively captures the functional purpose of the
// view controller that you are unwinding _to_
- (IBAction)unwindToMainMenu:(UIStoryboardSegue*)sender
{
}
Then in the IB scene that you are transitioning from, you can control+drag from the "dismiss" button to the exit outlets control (as shown in that technical note or as shown here or here) and choose your unwind segue. In my casual experimentation, when you perform the unwind segue, it would appear that you do not see the interim views briefly during the transition.

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.

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

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

Resources