View controller will dismiss without any animation when come back from background - ios

App on iOS6 and my iPhone is 4S, I present view controller using Storyboard and dismiss with following code:
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
It works fine until my app went to background and then come to foreground again, I present a view controller and dismiss it. The view controller will dismiss without any animation. I know it's a small problem but it did confuse me.
Is that a bug of iOS6 SDK?

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?

in ios 7 SKScene after dismissing view controller no response

In the start of a game after initializing first SKScene in root view controller I have menu where 3 button(sknodes) lead to other skscenes and one more button which leads to second view controller. After presenting the second view controller when I want to go back to first scene I use dismiss view controller, the root view controller with first scene appears and first scene is frozen.
If you click on the button that leads to some of the first 3 scenes then a new scene presents itself, but under the first scene. I cannot see it, but I can hear the sound of other scenes.
This is happening on devices on ios7; on ios8 it works like charm, the scene is not freezing. I present view controller like this
[self.view.window.rootViewController presentViewController:secondviewcontroller animated:NO completion:nil];
and dismiss
[self dismissViewControllerAnimated:NO completion:nil];
I tried with delegates, segue its same result, every possible solution here.

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

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