Hide dots on final page of UIPageViewController swift

后端 未结 5 1552
小鲜肉
小鲜肉 2021-01-16 08:59

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

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-16 09:28

    use the UIPageViewControllerDelegate method:

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

提交回复
热议问题