 import Foundation
 import UIKit
 
-let LXPageViewWithButtonsViewControllerCurrentViewControllerDidChangeNotification = "LXPageViewWithButtonsViewControllerCurrentViewControllerDidChangeNotification"
+public protocol LXPageViewWithButtonsViewDelegate {
+    func pageViewWithButtonsView(pageViewController: UIPageViewController, buttonsScrollView: LXButtonsScrollView, currentIndexUpdated index: Int)
+}
 
 public class LXPageViewWithButtonsViewController: UIViewController, UIPageViewControllerDelegate {
+    /// delegate
+    var pageViewWithButtonsViewDelegate: LXPageViewWithButtonsViewDelegate?
+    
     /// page view controller
     public let pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
     /// the scrollView inside the pageViewController

        if currentIdx == targetIndex {
            targetIndex = nil
        }
    }
    
    public var viewControllers : [UIViewController]? {

        buttonsScrollView.buttons.forEach { $0.selected = false }
        buttonsScrollView.buttons[currentIdx].selected = true
        
        /// scroll the scroll view if needed
        /// if the target button is already visible, then no need to scorll the view
        if !(targetIndex != nil && buttonsScrollView.isButtonVisible(targetIndex!)) {
