0

I'm trying to make a UICollectionView with horizontal scrolling and paging like Facebook's friend request UI. GIFV LINK. All the requests in this video are from fake profiles, so no worries about privacy.

I don't understand how I make them not full-screen, and still centered. I played around with offset, inset and sizing, but I just get it like this, where the offset grows every scroll. enter image description here

How do I keep the page

  • Less than max width
  • Centered
  • Showing a hint of the next and previous page

Like Facebook.

Oscar Apeland
  • 6,422
  • 7
  • 44
  • 92

1 Answers1

0

This a little bit tricky.

You'll need to turn off paging and use targetContentOffsetForProposedContentOffset:withScrollingVelocity to control the offset.

Edit: I made a simple example here.

Community
  • 1
  • 1
Cheng-Yu Hsu
  • 1,029
  • 7
  • 11