How unwindForSegue:towardsViewController: works?

In my simple app, I have created some controllers with basic segues between them:

Yellow controller -> BlueController -> GreenController -> OrangeController. Every of them has its own custom class.

From OrangeController I created unwindSegue to my YellowController. It is ok.

Within every class I put:

override func unwindForSegue(unwindSegue: UIStoryboardSegue, towardsViewController subsequentVC: UIViewController) {
    print(unwindSegue)
    print(subsequentVC)
}

But it was not called at all. Why? What demo should I prepare to test this functionality?

The same is with:

func allowedChildViewControllersForUnwindingFromSource(source: UIStoryboardUnwindSegueSource) -> [UIViewController]
func childViewControllerContainingSegueSource(source: UIStoryboardUnwindSegueSource) -> UIViewController?

Answers


Implement the method with IBAction returnType

-(IBAction) unwindForSegue:(nonnull UIStoryboardSegue *)unwindSegue towardsViewController:(nonnull UIViewController *)subsequentVC

In Storyboard, link the control (which is responsible for the back action) to the exit action in the viewcontroller.


Need Your Help

Unable to start simple Erlang cowboy application

erlang rebar cowboy

I am completely new to Erlang, apart from reading the odd book and website on syntax and basic structure. I decided to throw myself into it a bit and create a simple web server using cowboy. Every ...

Android fetch data from database

php android mysql sql-server database

I've decided to try out some DB connections for my android applikation. However I need some advice regarding structure.