         }
     }
     
-    private func updateTabAppearance() {
+    private func updateTabAppearance(animated animated: Bool = true) {
         if (tabGradient) {
             let currentIndex = pageIndex
             if (numberOfPages != 0) {
-                for i in 0..<numberOfPages {
+                for i in 0 ..< numberOfPages {
                     var alpha: CGFloat = 1.0
                     
                     let offset = abs(i - currentIndex)

                // set default position of tabs and contents
                tabSectionScrollView.contentOffset = CGPoint(x: tabOffsetX + tabSectionScrollView.contentInset.left * -1, y: tabSectionScrollView.contentOffset.y)
                contentSectionScrollView.contentOffset = CGPoint(x: contentOffsetX  + contentSectionScrollView.contentInset.left * -1, y: contentSectionScrollView.contentOffset.y)
                updateTabAppearance()
            }
            prevPageIndex = index
        }

            
            // setup tabs first, and set contents later (lazyLoadPages)
            var tabSectionScrollViewContentWidth: CGFloat = 0
            for i in 0 ..< numberOfPages {
                if let tabView = tabViewForPageAtIndex(i) {
                    tabView.frame = CGRect(
                        x: tabSectionScrollViewContentWidth,
