NickM
NickM

Reputation: 55

How to open View from UIPageViewController and return to back to the UIPageViewController

I'm having issues with opening a view from a UIPageViewController and returning back to the same page on the PageViewController. My current setup is a tutorial, you scroll across the pages to view the tutorial. On the second page it requires the user to make a selection of items off a TableView on another page (by clicking a button). How would I then return back to the second page of the UIPageViewController?

Upvotes: 0

Views: 43

Answers (1)

Prettygeek
Prettygeek

Reputation: 2531

You can use something like this: controller.setViewControllers([self.pages[page]], direction: .forward, animated: false, completion: nil)

Direction and animation is up to You.

You can show second vc from page just by using presentViewController:animated:completion: from your page. Set up some delegation to pass data between parent controller and presented controller.

After selection You just dismissViewControllerAnimated:completion: and You are right back where You are previously.

Upvotes: 1

Related Questions