             // first time setup pages
             self.setupPages()
             
-            
             // first time set defaule pageIndex
-            if (!self.isStarted) {
-                self.pageIndex = self.defaultPage
-                self.isStarted = true
-            } else {
-                
-                self.pageIndex = self.prevPageIndex
-            }
+            self.pageIndex = self.prevScrollingIndex ?? self.prevPageIndex ?? self.defaultPage
+            self.isStarted = true
             
             // load pages
             self.lazyLoadPages()

    
    override public func layoutSubviews() {
        super.layoutSubviews()
        
        dispatch_async(dispatch_get_main_queue()) {
            // set custom attrs

                    }
                    
                    UIView.animateWithDuration(NSTimeInterval(0.5), animations: { () in
                        if let tab = self.cachedPageTabs[i] {
                            tab.alpha = alpha
                            return
                        }
                    })
                }
            }
