首页 > 解决方案 > 如何在滚动另一个 UICollectionView 时自动滚动 UICollectionView?

问题描述

我在 ViewController 中有两个集合视图。需要在用户滚动底部 UICollectionView 时自动滚动顶部 collectionView。

标签: iosswiftuicollectionview

解决方案


你可以试试

func scrollViewDidScroll(_ scrollView: UIScrollView) { 
    topCollection.contentOffset = scrollView.contentOffset
    bottomCollection.contentOffset = scrollView.contentOffset
}

推荐阅读