ZCycleView
ZCycleView copied to clipboard
动态加载轮播图,一直在第一张
动态加载数据设置轮播图,一直滚动在第一张。采用snapkit布局 fileprivate func currentIndex() -> Int { let itemWH = scrollDirection == .horizontal ? flowLayout.itemSize.width+itemSpacing : flowLayout.itemSize.height+itemSpacing let offsetXY = scrollDirection == .horizontal ? collectionView.contentOffset.x : collectionView.contentOffset.y // contentOffset changes /(ㄒoㄒ)/~~ ?????????? if itemWH == 0 { return 0 } let index = round(offsetXY / itemWH) return Int(index) } 这段代码返回的一直是0