         
         UIApplication.shared.setStatusBarHidden(false, with: .fade)
         
-        let indexPath = IndexPath(item: viewController.currentPage, section: 0)
-        collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: false)
+        currentRow = viewController.currentPage
+        let indexPath = IndexPath(item: currentRow, section: 0)
+        collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: false)
     }
 
 }

    override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
        super.traitCollectionDidChange(previousTraitCollection)

        if collectionView != nil {
            collectionView.contentOffset = CGPoint(x: CGFloat(currentRow) * view.bounds.width, y: 0.0)
        }

    }
    
    func updateCurrentRow(to size: CGSize) {

        var row = Int(round(collectionView.contentOffset.x / collectionView.bounds.width))
        if row < 0 {
            row = 0
        }
        currentRow = row
        
    }
    
    // MARK: - UIContentContainer

    
}

// MARK: - Private Methods

extension ViewController {
    
    func updateCurrentRow(to size: CGSize) {
        
        var row = Int(round(collectionView.contentOffset.x / collectionView.bounds.width))
        if row < 0 {
            row = 0
        }
        currentRow = row
        
    }
    
}
