Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Sources/PagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
return
}

let top: CGFloat
if #available(iOS 11.0, *) {
top = -containerView.adjustedContentInset.top
} else {
top = -containerView.contentInset.top
}

if animated && pagerBehaviour.skipIntermediateViewControllers && abs(currentIndex - index) > 1 {
var tmpViewControllers = viewControllers
let currentChildVC = viewControllers[currentIndex]
Expand All @@ -162,12 +169,12 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
tmpViewControllers[currentIndex] = fromChildVC
tmpViewControllers[fromIndex] = currentChildVC
pagerTabStripChildViewControllersForScrolling = tmpViewControllers
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: fromIndex), y: 0), animated: false)
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: fromIndex), y: top), animated: false)
(navigationController?.view ?? view).isUserInteractionEnabled = !animated
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: index), y: 0), animated: true)
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: index), y: top), animated: true)
} else {
(navigationController?.view ?? view).isUserInteractionEnabled = !animated
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: index), y: 0), animated: animated)
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: index), y: top), animated: animated)
}
}

Expand Down