iOS 6.0: UICollectionView doesn't respect clipsToBounds with pagingEnabled

后端 未结 4 1269
太阳男子
太阳男子 2021-02-06 07:37

Background

I am implementing a UICollectionView (for the first time) in an effort to achieve a paged horizontal scroll view of tiles. I\'d

4条回答
  •  醉梦人生
    2021-02-06 08:42

    Turns out the solution to this was actually quite simple. I just needed to overlap the UICollectionViewCell cells by enough pixels to have them still show within the collectionView's frame after the paged scrolling finishes. The relevent code was

    layout.itemSize = CGSizeMake(300, 300);
    layout.minimumLineSpacing = -20.0;
    

    And I subclassed the UICollectionViewFlowLayout and overrode the (CGSize)collectionViewContentSize method to return the non-overlapped size of the cells.

提交回复
热议问题