knuspermagier.de
Er bloggt noch? Krass!

Fixing UIPageViewController's Top Layout Guide Problems

In a recent project I built a quick tutorial screen using a UIPageViewController. After creating all needed views and constraints I stumbled upon this awkward behaviour when changing the page:

bar_broken1.gif

Seems like the UIPageViewController does some strange this to the top layout guide of the contained view controllers. After trying every combination of switches in Interface Builder and some heavy stackoverflowing I fixed it using this code.

(self.topLayoutConstraint refers to the constraint defining the vertical space between the top view and the top guide)

bar_unbroken1.gif

Stay tuned for the next episode of "Philipp's Never Ending Search For Awkward Autolayout Behaviours".