0

My goal is to create a ring that is in the middle of the collection view. When a cell stops in the ring I want to run a function and fetch the index path of that cell. I don't want true pagination but more snap scrolling.

To visualize what I want... (This is an app on the app store)

photo

Notice that the black circle/ring stays in the same place while the collection view cells move.

photo2

How would I accomplish this?

coder
  • 381
  • 2
  • 22
  • what you had tried so far ? – Shubham Sharma Dec 24 '17 at 15:23
  • I have tried to add an image view as a subview to the collection view at the position of the first cell. For some reason the image view did not show up. I also need help figuring out how to have the uicollection view scroll in a way that it stops in the ring. – coder Dec 24 '17 at 15:57

1 Answers1

0

Add an UIImageView above the UICollectionView and set userInteractionEnabled to false.

But if the ring overlay just contains a black and white circle (as it seems on the photo's), you don't need an UIImageView. Instead, you can compose this with two transparent UIViews on top op each other, of which you set layer.borderColor and layer.borderWidth.

Of course you also need to set userInteractionEnabled to false on these two ring UIViews.

Then here you can find a few ideas of how to implement the snap scrolling.

meaning-matters
  • 21,929
  • 10
  • 82
  • 142