QuantumHoneybees QuantumHoneybees - 4 months ago 7x
iOS Question

How do I create two custom segues, one for each direction?

I was able to look up a way to transition between two ViewControllers using a UIScrollView that I can use as a transition between two VCs.

I have an issue however, I have a TableView with cells that trigger a different kind of segue when tapped. (The Segue is some labels move to the new VC and other stuff appears)

I then want to be able to swipe back and forth all while the first animation is controlled by how much I swiped between. For example. if the user swipes just a small bit I want the animations to reverse back, so that if he changes his mind, he can still stay on his current VC. But if he wants to go back to the old VC, the labels animate back in place.

Basically like Snapchat but only one to go back, and the labels revert back. The other way is by tapping.

Here is a video mockup of the animation, please excuse its crudeness


You need to read up on transition controllers. What you want to do is to create a custom transition controller, specifically a UIPercentDrivenInteractiveTransition. Take a look at this tutorial on the subject:

custom UIViewController Transitions