         
         // Update child view controllers' view frame
         for (index, viewController) in viewControllers.enumerated() {
-            viewController.view.frame = CGRect(x: CGFloat(index) * view.bounds.width, y: 0, width: view.bounds.width, height: view.bounds.height - segmentedControlHeight)
+            viewController.viewIfLoaded?.frame = CGRect(x: CGFloat(index) * view.bounds.width, y: 0, width: view.bounds.width, height: view.bounds.height - segmentedControlHeight)
         }
         
         // Update scroll indicator's vertical position

    open func scrollViewDidScroll(_ scrollView: UIScrollView) {
        // Delegate
        delegate?.pagerController?(self, scrollViewdidScroll: scrollView)
        
        // Update bar position
        scrollIndicator.frame.origin.x = scrollView.contentOffset.x/scrollView.contentSize.width * scrollView.frame.size.width

        
        setUpSegmentedControl(titles: titles)
        
        let indexes = self.visiblePageIndexes()
        
        // Then add subview, we do this later to prevent viewDidLoad of child view controllers to be called before page segment is allocated.
        for (index, viewController) in viewControllers.enumerated() {
            // Add first view controller to controller hierachy
            // Also, only add first child view controller's view to view hierachy
            if index == 0 {
                viewController.willMove(toParentViewController: self)
                addChildViewController(viewController)
            }
            
            // Add view controller's view if it must be visible in scroll view
            if let _ = indexes.index(of: index) {
                viewController.view.frame = CGRect(x: CGFloat(index) * view.bounds.width, y: 0, width: view.bounds.width, height: view.bounds.height - segmentedControlHeight)
                pageScrollView.addSubview(viewController.view)
            }
            
            if index == 0 {
                viewController.didMove(toParentViewController: self)
