简体   繁体   中英

iOS - Use/pass gesture recognizer for multiple Tableviews or Collectionviews in a View(Swift)

I've got 2 (circular) UICollectionviews in my view, both are functioning but I want to use 1 swipe gesture for both views so when I swipe on the top collectionview, the bottom view should also swipe with the same speed and vice-versa. What would be the best way to achieve this?

This is my UIViewController: 2通函集合视图

both collectionviews should scroll whenever I scroll anywhere on this UIViewController. Any help would be very appreciated.

Set scrollView delegate of your collectionView's scrollView . UICollectionView is a subclass of UIScrollView . Use scrollViewDidScroll method. In that method you can for example see contentOffset of one UICollectionView and then set contentOffset to the other collectionView's scrollView to that value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM