Flip ViewController, but support the same NavigationController with Storyboard

I am trying to flip the viewcontroller inside the navigation controller, but with little success so far I have tried to use thousands of solutions, but none of them work. I want to flip the controller as follows:

Click the button to go to the map: http://i39.tinypic.com/fabul3.jpg

Press the same button to return with the shift image: http://i40.tinypic.com/2qa1y0h.jpg

I need to maintain coherence with storyboard for segue. Do you have any ideas or examples on how to do this?

+1
source share
2 answers

Instead of flipping a view controller, it may be easier for you to translate the view. There's a standard way to flip the views that are covered in this question:

How to implement flip transition effect for UIView

Alternatively, you can always try and translate the view controller itself through the user segment, but I suspect it will be much easier to handle the translation at the UIView level.

+2
source

You can create a new UIViewController that contains the container view in the storyboard, and assign a controller for the train network map view as a container.

Then in the code you can create an instance of the map display controller from the storyboard:

self.mapViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MapViewController"]; 

Read more about the container view to understand the following lines, assuming networkMapViewController is the initial view controller that you want to flip into mapViewController:

 [self.networkMapViewConroller willMoveToParentViewController:nil]; [self addChildViewController:self.mapViewController]; [self.mapViewController didMoveToParentViewController]; 

Then you can use the controller method viewFromViewController: toViewController: duration: options: animations: completion:

 [self transitionFromViewController:self.networkMapViewController toViewController:self.mapViewController duration:.5 options:UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:^(BOOL finished) { [self.networkMapViewController removeFromParentViewController]; }]; 

You will need to compose similar lines to change back from the map display controller to networkMapViewController.

+1
source

Source: https://habr.com/ru/post/1239392/


All Articles