How to hide dots in last view of UIPageViewController SWIFT

I want to hide pagination points in the last view of the UIPageViewController. There is a question that has already asked the question, but it never answers.

If only someone could give me an overview of how this is possible.

thank

EDIT:

func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
        pageControl.hidden = true
        print(pageControl.hidden)//Always is false
    }
+4
source share
1 answer

use the UIPageViewControllerDelegate method:

let pageControl = UIPageControl()

override func viewDidLoad(){
    super.viewDidLoad()
    pageControl.numberOfPages = numberOfPages()
    pageControl.currentPage = 0
    view.addSubview(pageControl)
    pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
    pageControl.pageIndicatorTintColor = UIColor.whiteColor().colorWithAlphaComponent(0.4)
}

func numberOfPages() -> Int {
    return 4 //your number of pages
}

func pageViewController(pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
    if (index == numberOfPages()-1){
          pageControl.hidden = true
    }else{
          pageControl.hidden = false
    }
}

you can also go to icarousel very powerful and easy to implement https://www.youtube.com/watch?v=OLvZbXOAZQY

+1
source

Source: https://habr.com/ru/post/1651564/


All Articles