Dismiss the PageViewController and load a new ViewController
I've been working on pageViewController in swift and xcode. I used the default template in xcode and made a pageViewController app. But now I want to put a button on pageViewController that is displayed on all pageViewControllers, and when that button is clicked, the pageViewController is fired and the RootViewController screen is shown back. I wrote this line but it doesn't do anything.
self.dismiss(animated: true, completion: nil)
But that won't help. Could you please tell me how can I achieve this? Thank.
+3
source to share
2 answers
You have to use popToRootViewController () . You can have a navigation bar with a button that calls this function, so whatever view you are currently using will appear in the root controller.
0
source to share