Search code examples
iosswiftuipageviewcontroller

Make a toolbar that is part of a UIPageViewController


I have been implementing a UIPageViewController and would like to add a toolbar to the bottom of my UIPageViewController that contains 3 buttons. Sadly, I can't figure out how to do this as I can only put the toolbar on one of the UIViewControllerand when I transition to another view controller the toolbar is no longer there. Is it possible to create a toolbar that spans all UIViewController's that are embedded in the UIPageViewController? Thanks in advance.

edit: I have already implemented my UIPageViewController and have added two UIViewControllers inside the UIPageViewController. Is it still possible? Maybe it is possible to embed my already created UIPageViewController in a UIVIewController?


Solution

  • Create UIViewController and add UIPageViewController in that. Add that toolbar on UIViewController. after adding UIPageviewcontroller bring subview to front that toolbar.

    So your view hierarchy will be UIViewController > UIPageviewcontroller > Toolbar.

    As your toolbar is added on UIViewController it will be shown above all pageviewcontroller's viewcontroller.