     }
   }
   
+  public override func viewWillLayoutSubviews() {
+    super.viewWillLayoutSubviews()
+    scrollView.frame = view.bounds
+  }
+
   func layoutViews(for viewControllers: [UIViewController], keepContentOffset: Bool) {
     let viewControllers = isRightToLeft ? viewControllers.reversed() : viewControllers
+
+    // Need to trigger a layout here to ensure that the scroll view
+    // bounds is updated before we use its frame for calculations.
+    view.layoutIfNeeded()
 
     for (index, viewController) in viewControllers.enumerated() {
       switch options.contentNavigationOrientation {

  
  public override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    view.layoutIfNeeded()
    manager.viewWillAppear(animated)
  }
  

  override public func viewDidLoad() {
    super.viewDidLoad()
    view.addSubview(scrollView)
    scrollView.delegate = self
    
    if #available(iOS 11.0, *) {
