Good day! I study work with segue between two ViewController. I wanted to know how to use the segue call when scrolling from right to left or vice versa? What segue need to bind (ViewController, View, Button)? Type should be Custom? And what is the Segue Module (when choosing Custom)? Thank!

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦

2 answers 2

Maybe better to use UIPageViewController?

Another way is:

Check that the user made the desired swipe from right to left and present the second ViewController.

1) And you can make a custom presentation, i.e. how the second ViewController will appear.

2) Either use the standard presentviewcontroller when producing a swipe:

ViewController *viewController = (ViewController*)[self.storyboard instantiateViewControllerWithIdentifier:@"secondView"]; viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentViewController:viewController animated:YES completion:nil]; 

To come to the previous ViewController, then use the same, only with a different Identifier, or is it

 [self dismissViewControllerAnimated:YES completion:nil]; 

3) Or use pushviewcontroller:

 ViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"secondView"]; [self.navigationController pushViewController:controller animated:YES]; 

To come to the previous ViewController, then use the same, only with a different Identifier, or is it

 [self.navigationController popToRootViewControllerAnimated:YES]; 

PS: segue in this case is better not to use (if at all possible).

Swipe you can check with Swipe Gesture Recognizer

Good luck!

    If you need to make a simple transition between 2 ViewController, then it is enough to link the button on the first ViewController with the second ViewController. Type specify depending on the desired result. Custom, if I remember correctly, for manual processing Segue.

    • the transition is simple. but it should not be caused by pressing, but when scrolling from the edge of the screen - Dmitrii Titov