Here I have a pagecontrol which works good but on clicking on dot it doesn\'t change the page so please help in the function of changepage:
- (void)viewDidLo
Just to complete Banker Mittal's answer, the easiest way to do it in swift is to scroll the wanted rect to visible. You don't have to take care of "left" and "right" scrolling because iOS itself realizes which dot you tapped so you can just scroll to the correct frame:
private func moveScrollViewToCurrentPage() {
//You can use your UICollectionView variable too instead of my scrollview variable
self.scrollView
.scrollRectToVisible(CGRect(
x: Int(self.scrollView.frame.size.width) * self.pager.currentPage,
y: 0,
width:Int(self.scrollView.frame.size.width),
height: Int(self.scrollView.frame.size.height)),
animated: true)
}