Skip to content
Closed
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
15 changes: 15 additions & 0 deletions Sources/PagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,21 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
open override var shouldAutomaticallyForwardAppearanceMethods: Bool {
return false
}

open func setupDefaultViewController(at index: Int) {
guard currentIndex != index else { return }
guard isViewLoaded, !self.viewControllers.isEmpty else {
currentIndex = index
return
}
guard view.window != nil else {
let step = (currentIndex < index) ? 1 : -1
for subindex in stride(from: currentIndex+step, through: index, by: step) {
containerView.setContentOffset(CGPoint(x: pageOffsetForChild(at: subindex), y: 0), animated: false)
}
return
}
}

open func moveToViewController(at index: Int, animated: Bool = true) {
guard isViewLoaded && view.window != nil && currentIndex != index else {
Expand Down