【发布时间】:2020-07-10 14:46:32
【问题描述】:
因为我已使用此代码在 pageControl 中获取当前页面索引。但是这个函数无法区分scrollView是针对哪个collectionView的。
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if collectionView == self.brandCollectionView {
brandPageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width)
} else {
brandPageControl.currentPage = Int(scrollView.contentOffset.x) / Int(scrollView.frame.width)
}
}
【问题讨论】:
标签: swift uicollectionview scrollview uipagecontrol