title: UICollectionView - Horizontal paging with 3 pages visible and 1 in the middle using UICollectionView
body: <p>I'm trying to implement same feature like mobile Safari has when scrolling among different pages using UICollectionView. One page is in the middle and parts of other are also visible.</p>
  
  <p><img src="https://i.stack.imgur.com/aJ6jQ.png" alt="enter image description here"></p>
  
  <p>I am struggling to achieve such a behaviour using UICollectionView. There is 1 way I found how to put 3 pages at one screen - make pages smaller and set appropriate insets. But as soon as I set pages smaller and I set paging enabled, pages are not scrolled to the centre as they should. I can also leave paging disabled and use this method in subclass of UICollectionViewFlowLayout:</p>
  
  <pre><code>- (CGRect)rectForTargetPageForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
  </code></pre>
  
  <p>In this method I can set exactly where UICollectionView will stop. However, scrolling experience is not as good as it was as using UIScrollview with paging enabled. When I swiped with bigger velocity, several pages were scrolled and it stopped on proposed page. What I want to achieve is same behaviour as normal scroll view with paging enabled - whatever velocity I use, I will get only 1 page more. </p>
  
  <p>Do anyone have any idea how to solve this using UICollectionView?</p>