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:

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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewWillLayoutSubviews { | |
[super viewWillLayoutSubviews]; | |
self.topLayoutConstraint.constant = -1 * self.topLayoutGuide.length; | |
} |
(self.topLayoutConstraint refers to the constraint defining the vertical space between the top view and the top guide)

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