in ios 7 SKScene after dismissing view controller no response - ios

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.

Related

Dismiss Modally presented view makes tab bar controller (kind of) reset

I have an app which has tab bar controller as main controller. Each tab has a series of views with navigation controller and I normal push and pop those view in stack.
Weird problem is
Case 1 : If I create a UINavigationController and make a new viewController as its root, and present this NavigationController. Within this new navigation stack, I can easily present a view modally and dismiss it without a problem.
Case 2: Now without make a new UINavigationController, I present a view, and when I dismiss a view, the view beneath is behave weirdly. For example, it's the presenting view was UICollectionView, it just scroll back to 1st cell, like it's doing "reload" action and "scrollTo" the first cell. If the presentingView is a pushed view from rootView, it will just popToRoot view, which is definitely not intended.
I didn't have this problem until I implement UITabbarController, so I guess, I should know more that's going on under the hood when presenting a view and dismiss a view in UITabbarController.
I GUESS, when dismiss a view in UITabbarController view, it sort of "RESET" everything to the very first view of it's current tab. I really am not sure it's trure though.
I know it's kind of conceptual, but I can't help to think there must be something critical I am missing here.
I made silly mistake that I sublclass UITabbarController and define navigation controlllers in viewDidAppear instead viewdidLoad, so when I make the window's rootview to tabbar controller, the navigation controllers are not set properly. That's why all punky things happened. It would be nicer if just crash instead of this weird behaviors.
You can try this to go back to your first viewcontroller.
- (IBAction)buttonPressedFromVC2:(UIButton *)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
} // This is going back to VC1.
This method is will be in second viewcontroller.m file. It is button click method.

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.

iOS 8 view controller presented via UIModalPresentationCustom cannot itself present any view controllers? Also unable to dismiss

In iOS 7 everything worked as expected. With no code changes, in iOS 8, my menu view controller cannot itself present any other view controllers and prints an error to the log when I try and dismiss it. When I try to present more view controllers on the stack, from within the VC that was presented using my custom transition, I try to and simply nothing happens, as if I'm calling methods on nil when I'm not. Here's how I present it:
// Get menu from storyboard
UINavigationController *modalViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"MenuNavigationController"];
// Set self as transition delegate
modalViewController.modalTransitionStyle = UIModalPresentationCustom;
modalViewController.transitioningDelegate = self;
// Present menu
[self presentViewController:modalViewController animated:YES completion:^{}];
Then, when I try to present more view controllers from within the presented menu vc, nothing happens in iOS 8! However, when I try and dismiss my menu that has been presented in a custom fashion I get this in the console/log:
attempt to dismiss modal view controller whose view does not currently appear. self = <UINavigationController: 0x7f90e8f5b210> modalViewController = <UINavigationController: 0x7f90e9bf63b0>
Any ideas? What's different between iOS 7 and 8 when it comes to presenting a view controller modally using a custom transition? The main problem I'm trying to solve is that I want my menu to be able to push on additional view controllers just like it has always been able to do in iOS 7. I also need to figure out how to dismiss the menu VC without error!
Any ideas?

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.

Resources