Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPageViewController has strange size

I am using a UIPageViewController in my app. It works quite well, but when I turn pages, the next page seems to get initialized in a frame that is bigger than the screen: While turning the page, only a part of the view of the next viewController fits on the screen.

I am initializing the UIPageViewController in viewDidLoad and started to log the frames of the PageVC, its subviews and the parentVC. Every frame seems to be okay, only the UIPageViewController's frame, which I log in viewControllerAfterViewController has a width that is nearly the double of the screen's actual size.

like image 402
FD_ Avatar asked Oct 21 '12 13:10

FD_


1 Answers

I finally solved this issue by setting the right frame to the UIPageViewController's view when initializing the PageVC:

pageViewController.view.frame = self.view.frame;

Where pageViewController is the UIPageViewController I initialize, and self is the parent VC of the pageVC.

Hope this helps anyone with similar problems.

like image 98
FD_ Avatar answered Oct 20 '22 00:10

FD_