File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,22 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
147147 open override var shouldAutomaticallyForwardAppearanceMethods : Bool {
148148 return false
149149 }
150+
151+ // 这里是 default selector pager
152+ open func setupDefaultViewController( at index: Int ) {
153+ guard currentIndex != index else { return }
154+ guard isViewLoaded, !self . viewControllers. isEmpty else {
155+ currentIndex = index
156+ return
157+ }
158+ guard view. window != nil else {
159+ let step = ( currentIndex < index) ? 1 : - 1
160+ for subindex in stride ( from: currentIndex+ step, through: index, by: step) {
161+ containerView. setContentOffset ( CGPoint ( x: pageOffsetForChild ( at: subindex) , y: 0 ) , animated: false )
162+ }
163+ return
164+ }
165+ }
150166
151167 open func moveToViewController( at index: Int , animated: Bool = true ) {
152168 guard isViewLoaded && view. window != nil && currentIndex != index else {
You can’t perform that action at this time.
0 commit comments