UICollectionView align logic missing in horizontal paging scrollview

前端 未结 16 1202
天命终不由人
天命终不由人 2020-12-07 06:49

I\'ve got a UICollectionView, which works ok, until I start scrolling. Here some pics first: \"enter

16条回答
  •  情书的邮戳
    2020-12-07 07:34

    enter image description here

    The solution from the following article is elegant and simple. The main idea is creation the scrollView on top of your collectionView with passing all contentOffset values.

    http://b2cloud.com.au/tutorial/uiscrollview-paging-size/

    It should be said by implementing this method:

    - (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity;
    

    I didn't achieve a smooth animation like it's happening with pagingEnabled = YES.

提交回复
热议问题