【发布时间】:2017-11-08 21:18:40
【问题描述】:
我在我的应用中使用SCPageViewController:
class RootPageViewController: UIViewController {
var pageViewController : SCPageViewController = SCPageViewController()
var viewControllers = [UIViewController]()
......
在 viewDidLoad 我正在配置它:
self.pageViewController.setLayouter(SCPageLayouter(), animated: false, completion: nil)
self.pageViewController.easingFunction = SCEasingFunction(type: SCEasingFunctionType.linear)
self.pageViewController.dataSource = self;
self.pageViewController.delegate = self;
self.addChildViewController(self.pageViewController)
self.pageViewController.view.frame = self.view.bounds
self.view.addSubview(self.pageViewController.view)
self.pageViewController.didMove(toParentViewController: self)
我在 SCPageViewController 数据源方法中将内容视图控制器的大小设置为 RootPageViewController 的大小。当应用程序启动时,我的“状态栏”只是普通的 UIView,背景颜色位于系统状态栏后面。但是当我滚动到下一页/上一页时,它会偏移几个像素。我怎么能统一呢?为什么我在上面得到这么小的偏移量?
我正在使用 Storyboard 对视图控制器进行建模:
这是应用启动后的样子(如预期的那样):
当我滚动到下一页时:
这个白色区域不应该在那里...旋转设备后一切都很好。
【问题讨论】:
标签: ios iphone swift uiviewcontroller uipageviewcontroller