Search code examples
iosswiftuipageviewcontroller

UIPageViewController in Contrainer View


I am trying to embed UIPageViewController into Container View. The ContainerView has the following layout:

enter image description here

It consists of UIViewController which holds Container View and 2 buttons at the bottom.

The connection between Container View and UIPageViewController is established through "embed segue".

UIPageViewController manages 3 UIViewControllers. Each UIViewController represents app walkthrough tutorial screen, and has the following layout:

enter image description here

The Problem: When I run the app, the first walkthrough screen looks as it is supposed to, meaning all the layout elements are displayed properly:

enter image description here

However, when I scroll to the next walkthrough screen only UIImageView is displayed, pushing down the other two labels, that are below it, out of the frame:

enter image description here

I was wondering how can the Container View display all elements of the UIViewControllers managed by UIPageViewController?


Solution

  • I have solved this issue by putting the contents of tutorial screen inside vertical stack view, and giving the UIImageView lesser Content Compression Resistance Priority