change pages in UIPageViewController Automatically with timer in swift 3?

后端 未结 1 1991
执笔经年
执笔经年 2021-01-14 09:34

I have UIPageViewController that Contains 4 view Controllers

I set the timer for changing view controllers automatically(going to the next view control

相关标签:
1条回答
  • 2021-01-14 10:34

    Try this:

    You can change view controller by index of VCArr.

    var index = 0
    
    func changeSlide() {
        index + 1
        if index < self.VCArr.count {
            setViewControllers([VCArr[index]], direction: .forward, animated: true, completion: nil)
        }
        else {
            index = 0
            setViewControllers([VCArr[0]], direction: .forward, animated: true, completion: nil)
    
        }
    }
    
    0 讨论(0)
提交回复
热议问题