     func viewControllerTitle(page:Int) -> String
 }
 
+public protocol SGTabbedPagerDelegate {
+    //func willShowViewController(page:Int) -> Void
+    func didShowViewController(page:Int) -> Void
+}
+
 public class SGTabbedPager: UIViewController, UIScrollViewDelegate {
+    
+    public var datasource : SGTabbedPagerDatasource? = nil
+    public var delegate : SGTabbedPagerDelegate? = nil
+    
     private let tabHeight = CGFloat(44);
-    public var datasource : SGTabbedPagerDatasource? = nil
     private var titleScrollView, contentScrollView : UIScrollView!
     private var viewControllers = [UIViewController]()
     private var viewControllerCount : Int = 0
-    private var tabLabels = [UIButton]()
+    private var tabButtons = [UIButton]()
     private var bottomLine, tabIndicator : UIView!
     private var selectedIndex : Int = 0
     private var enableParallex = true

        layoutTabIndicator()
    }
    
    /// Position the marker below the tab
    func layoutTabIndicator() {
        let labelF = tabLabels[selectedIndex].frame
        tabIndicator.frame = CGRectMake(labelF.origin.x, labelF.size.height-4, labelF.size.width, 4)
    }
    

            button.titleLabel?.textAlignment = .Center
            button.sizeToFit()
            button.addTarget(self, action: "receivedButtonTab:", forControlEvents: .TouchUpInside)
            self.tabButtons.append(button)
            self.titleScrollView.addSubview(button)
        }
    }
    
    /// Action method to move the pager in the right direction
    public func receivedButtonTab(sender :UIButton)  {
        if let i = find(tabButtons, sender) {
            switchPage(i, animated:true)
        }
    }
