Reputation: 376
I've implemented iCarousel in my app. I would like to have the iCarousel scroll by user iteration to one direction only.
My scenario is a list of views where the user can only go to the next one (the one to the right) by answering a question on the current view, so he can't go to the next one until he answers that. Once he answers, I'm programmatically scrolling to the next item . I still would like to have the users be able to scroll back previous views (to the left).
Right now I'm setting scrollEnabled
to NO
so the user can't scroll at all.
I thought of doing something with carouselWillBeginDragging:
and changing the scrollEnabled
to NO
depending of which direction he is scrolling, and set the scrollEnabled
back to YES
on carouselDidEndDragging:
, but I couldn't figure out a reliable way of finding out which direction the user is scrolling.
Any suggestions or ideas are appreciated!
Upvotes: 0
Views: 774
Reputation: 2451
A little google magic and it showed me the answer to your question.
If your question is "How to detect the the direction of the scroll?" well it was already answered
here is the link
Edit::
in iCarousel.h
show - (void)didPan:(UIPanGestureRecognizer *)panGesture;
then create a subclass of iCarousel.
in the iCarouselsubclass.m
:
-(void)didPan:(UIPanGestureRecognizer *)panGesture{
// check direction here using values for super didPan method
[super didPan:panGesture]; // do not call if you dont want to scroll the view
}
Upvotes: 1