有没有一种方法可以暂停iOS版iCarousel中的图像



我目前正在为该项目使用iCarousel,并被要求将正面的每个图像暂停N秒,然后继续滚动(有自动滚动方法(。我试着使用双定时器,试图改变图像,但没有成功。

这就是我想到的:

var activeItemIndex = 0
Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { timer in
activeItemIndex += 1
if activeItemIndex == carousel.numberOfItems {
activeItemIndex = 0
}
carousel.scrollToItem(at: activeItemIndex, duration: 3)
}

最新更新