dar512
dar512

Reputation: 872

How do you create an infinite scroll carousel in ios?

I want to make a carousel which only covers part of the page. I also want it to start over from the beginning when it reaches the end.

Upvotes: 0

Views: 3003

Answers (1)

Rafał Sroka
Rafał Sroka

Reputation: 40030

It is relatively easy. You just need to set content offset back to the beginning when you reach the end of the content. It will be transparent for the user and look like endless scroll view.

How to

  1. Let's say you have a scroll view with fixed content width.
  2. You set the content offset to somewhere in the middle (starting position).
  3. You have to check in scrollViewDidScroll: method if you should adjust the content offset to mimic endless scrolling.

Look into this question for implementation details:

how can i make uiscrollview infinite in ios?

Upvotes: 3

Related Questions