11
votes

I am using a page view controller to flip through a series of view controller, each of which is instantiated from a storyboard. I basically used the standard page based application code as a basis and built what I needed on top of it. The view controllers I'm flipping through are UITableViewController subclasses or custom view controller's that contain custom scroll views or what not.

The page view controller is embedded in a navigation controller, but none of the view controllers are respecting the top layout guide, even though the constraints are set to the layout guides in the storyboard in the case of my custom view controllers and I thought that the table view controller would manage this automatically. I mean the view's contents start from (0.0, 0.0) instead of where the user can see it. The only thing that works is actually setting the frames of the view controller's views to begin just under the status bar + the navigation bar, but I want the scroll view's to scroll under the transparent navigation bar.

What am I doing wrong or not doing?

3
This has been discussed a bit here stackoverflow.com/questions/19140530/…Mike Pollard

3 Answers

18
votes

It sounds like you don't want your content view controller's to underlap the navigation and status bars. If that's the case, try setting parent view controller's edgesForExtendedLayout property to UIRectEdgeNone.

// implementation of page view controller's parent view controller
- (void)viewDidLoad
{
    [super viewDidLoad];

    self.pageViewController = ...

    ...

    self.edgesForExtendedLayout = UIRectEdgeNone; // iOS 7 only
}
8
votes

For me, setting automaticallyAdjustsScrollViewInsets = NO; on the UIPageViewController fixed the issue. You can change that in the Interface Builder, under Attribute Inspector, uncheck "Adjust Scroll View Insets".

4
votes

On storyboards:

Uncheck values in parentviewcontollers "Extend Edges" section

Storyboard screenshot