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
6 changes: 5 additions & 1 deletion Sources/PagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
}

open func moveToViewController(at index: Int, animated: Bool = true) {
guard isViewLoaded && view.window != nil && currentIndex != index else {
guard isViewLoaded && (view.window != nil || animated == false) && currentIndex != index else {
preCurrentIndex = index
return
}
Expand All @@ -166,6 +166,10 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
(navigationController?.view ?? view).isUserInteractionEnabled = !animated
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: index), y: 0), animated: true)
} else {
if(view.window == nil) {
preCurrentIndex = index
currentIndex = index //in case of bounds change - otherwise the contentOffset is being reset in updateContent()
}
(navigationController?.view ?? view).isUserInteractionEnabled = !animated
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: index), y: 0), animated: animated)
}
Expand Down