UIPageViewController has strange size

▼魔方 西西 提交于 2019-12-23 07:12:31

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/12998322/uipageviewcontroller-has-strange-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!