user2005643
user2005643

Reputation:

How do you get a UIPageViewController to work when rotated to landscape?

In this tutorial on UIPageViewController (there's a download for the project at the bottom) the author sets up a great UIPageViewController that works flawlessly in portrait mode.

But it goes completely awry when rotating to landscape. The image is pushed to the bottom left corner, and in general it's just completely messed up.

I cannot figure out how on earth to solve this issue. I've searched and searched, and no example projects seem to work in landscape. What do I need to do in order to make it work in landscape?

Upvotes: 3

Views: 609

Answers (3)

Shardul
Shardul

Reputation: 4274

Try following settings. It may help you.

enter image description here

enter image description here

Upvotes: 0

vokilam
vokilam

Reputation: 10323

PageContentViewController in that tutorial has no layout constraints applied to its views.

For UIImageView I set space to superview in each direction. For UILabel I set space to superview in each direction except bottom.

Now image is stretched.

Upvotes: 1

ebandersen
ebandersen

Reputation: 2352

I just implemented UIPageViewController in my most recent project so here's a snapshot of some of the properties I'm using to set it up correctly. Essentially, it's the placement of the spine location that is probably messing up your display. Try playing with the different values (i.e. None, Mid, Min, Max) and see what works for you.

UIPageViewController landscape properties

Upvotes: 1

Related Questions