faganello60/CustomSegmentedControl

Change method is not calling even in your example also

Opened this issue · 2 comments

Change method is not calling even in your example also.... i have been added added delegate in view controller class also but change method is not call. please help as soon as possible... my class delegation is like that

class WifiWatchViewController: UIViewController, CustomSegmentedControlDelegate {

func change(to index:Int) {
print("segmentedControl index changed to (index)")
}
}

please update me otherwise i have to change my solution....... its my request

Same issue.

I added an array of type () -> Void inside the segmented control element in order to take actions when the index changes:

flatSegmentedControl.actions = [
    { self.setViewControllers([self.viewControllerList[0]], direction: .reverse, animated: true, completion: nil) },
    { self.setViewControllers([self.viewControllerList[1]], direction: .forward, animated: true, completion: nil) }
]