DroidsOnRoids / SwiftCarousel

Lightweight, written natively in Swift, circular UIScrollView.
http://www.thedroidsonroids.com/blog/ios/circular-scroll-view-swiftcarousel/
MIT License
144 stars 43 forks source link

SwiftCarousel with only one cell #21

Closed frranck closed 8 years ago

frranck commented 8 years ago

Hi, If you put only one cell, the SwiftCarousel will start in the middle of it (half right to the left, half left to the right), and I noticed that it "get stuck" while scrolling to the left after a moment. Could there be an option no to have the "infinite loop" feature ?

sunshinejr commented 8 years ago

Hmm, you think about disabling scrolling method/parameter?

frranck commented 8 years ago

@sunshinejr sorry?

aocenas commented 8 years ago

@frranck do you mean, when there is only one view in the items array? I think I have similar issue, where if I have only few items in the carousel (sum of items widths is less than carousel width) it acts a bit weird. It seems that the buffers of 1 copy of items array on each side is not enough for the scrolling math in that case.

frranck commented 8 years ago

@aocenas yes, bellow 3, it's buggy

aocenas commented 8 years ago

I think this could be easily fixed by having bigger buffer of items on each side, either by some better magic constant, or by measuring the provided item views and making copies until they are at least 3x carousel width or something similar. Making "disable infinite loop" param is probably different kind of decision.

frranck commented 8 years ago

@aocenas i'm using 1 item per page...

sunshinejr commented 8 years ago

What I think we can do is to disable scrolling (I mean you could drag the item, but you wouldn't be able to scroll) when there aren't any more items on the list that aren't shown. E.g. you have 3 items in array, but you have 3 items per page and it could disable scrolling then. We could even add that as a property?

frranck commented 8 years ago

@sunshinejr Yes and we should not see more items in the borders in that situation.

sunshinejr commented 8 years ago

Okay, I'm on it.

frranck commented 8 years ago

:thumbsup:

sunshinejr commented 8 years ago

Closed in favor of #28.