How to snap horizontal paging to multi-row collection view like App Store?

后端 未结 3 1085
孤街浪徒
孤街浪徒 2021-02-01 22:41

I would like to replicate the paging in the multi-row App Store collection view:

So far I\'ve designed it as close as possible to the way it looks, including sh

3条回答
  •  失恋的感觉
    2021-02-01 22:51

    A UICollectionView (.scrollDirection = .horizontal) can be used as an outer container for containing each list in its individual UICollectionViewCell.

    Each list in turn cab be built using separate UICollectionView(.scrollDirection = .vertical).

    Enable paging on the outer UICollectionView using collectionView.isPagingEnabled = true

    Its a Boolean value that determines whether paging is enabled for the scroll view. If the value of this property is true, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is false.

    Note: Reset left and right content insets to remove the extra spacing on the sides of each page. e.g. collectionView?.contentInset = UIEdgeInsetsMake(0, 0, 0, 0)

提交回复
热议问题