UIPageViewController doesn't resize view properly when in UINavigationController

Originator:senior
Number:rdar://14727968 Date Originated:13-Aug-2013
Status:Open Resolved:
Product:iOS SDK Product Version:7.0
Classification:Bug Reproducible:Always
 
Summary:

In iOS 7, when a UIPageViewController is added as a child view controller of a container view controller, which is in turn placed inside a UINavigationController, it doesn't correctly set the initial frame of its current view controller's subview.

The UIPageViewController's view appears shifted vertically off screen by the height of the navigation bar. Interacting with the view causes it to animate into the correct position.

Steps to Reproduce:

- Create a UIViewController subclass FooController
- Add a UIPageViewController as a child view controller of an instance of FooController:

- (void)viewDidLoad
{
    [super viewDidLoad];
	
	// page view controller containment
	[self addChildViewController:_pageViewController];

	UIView *pageView = [_pageViewController view];
	[pageView setBackgroundColor:[UIColor blueColor]];
	[pageView setFrame:[[self view] frame]];
	[pageView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];

	[[self view] addSubview:pageView];
	
	[_pageViewController didMoveToParentViewController:self];
}

- Create a UINavigationController with the instance of FooController as the root view controller and set it as the root view controller of the application's window.

Expected Results:
The view is not translated vertically offscreen. This is what occurs in iOS 6.

Actual Results:
The view is translated vertically offscreen. Tapping the view causes it to animate into the correct position. This only occurs in iOS 7.

Regression:

Notes:
See sample code. I'm fairly certain this didn't occur in beta 4.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!