I have four pages in a UIPageViewController, and I\'d like to hide the dots on the last page. I successfully made a function that gets called on the last page of the UIPageV
I found that you can't actually hide the page control as it just never works. But a bit of a hack is to add this to your code:
func pageViewController(pageViewController: UIPageViewController, willTransitionToViewControllers pendingViewControllers: [UIViewController]) {
if let lastVC = pendingViewControllers.last?.isKindOfClass(youLastViewController){
if lastVC == true {
for view in self.view.subviews {
if view is UIScrollView {
view.frame = UIScreen.mainScreen().bounds
} else if view is UIPageControl {
view.center.y = self.view.frame.height * 1.5
}
}
}else {
for view in self.view.subviews {
if view is UIScrollView {
view.frame = UIScreen.mainScreen().bounds
} else if view is UIPageControl {
view.center.y = self.view.frame.height * 0.92
}
}
}
}
}
}
This actually move the page control of the screen and the same as hiding it.