iOS6 UICollectionView and UIPageControl - How to get visible cell?

后端 未结 7 2094
甜味超标
甜味超标 2020-12-02 12:37

While studying iOS6 new features I got a question about UICollectionView.
I am currently testing it with Flow layout and the scroll direction set to horizontal, scrolli

7条回答
  •  旧巷少年郎
    2020-12-02 13:07

    Simple Swift

    public func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
        pageControl.currentPage = (collectionView.indexPathsForVisibleItems().first?.row)!
    }
    

    UIScrollViewDelegate is already implemented if you implement UICollectionViewDelegate

提交回复
热议问题