I'm using xcode 9.1 and swift 4. I have 2 Buttons in my View Controller, and i want their colors changed when my carousel page is changed. Here's my code but it. I want it to check every time my carousel Scrolls. is there any "OnPageControl" Methods in swift 4?
Here's my code ( in viewDidLoad ) :
if (self.carousel.pageControl.currentPage == 0) { self.registerButton.layer.borderColor = UIColor(red:68/255.0, green:180/255.0, blue:194/255.0, alpha: 1.0).cgColor self.loginButton.layer.backgroundColor = UIColor(red:68/255.0, green:180/255.0, blue:194/255.0, alpha: 1.0).cgColor NSLog("1") } else if (self.carousel.pageControl.currentPage == 1) { self.registerButton.layer.borderColor = UIColor(red:139/255.0, green:21/255.0, blue:21/255.0, alpha: 1.0).cgColor self.loginButton.layer.backgroundColor = UIColor(red:139/255.0, green:21/255.0, blue:21/255.0, alpha: 1.0).cgColor NSLog("2") } else if (self.carousel.pageControl.currentPage == 2) { self.registerButton.layer.borderColor = UIColor(red:174/255.0, green:135/255.0, blue:46/255.0, alpha: 1.0).cgColor self.loginButton.layer.backgroundColor = UIColor(red:174/255.0, green:135/255.0, blue:46/255.0, alpha: 1.0).cgColor NSLog("3") }
UIPageViewController?