Reputation: 5150
I have a UIScrollView with 10 items, I want that each time that I scroll with my finger to right or left it will scroll only 1 item at the time. Even if i'm throwing the item fast as I can, only I item at the time.
The problem that I'm having that I have 2 items visible each time and also I don't really know how to do it, I just know that it's have to be done with
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
and with - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
It looks like that when swiping:
Thanks in advance..
Upvotes: 1
Views: 788
Reputation: 845
Yes, paging is what will get that discrete scrolling, however, since you are displaying 2 pages at once, that will actually scroll both pages left or right.
You might try using a swipe gesture recognizer, detecting a left or right and then simply animate a fixed distance left or right. It's pretty simple to do.
Upvotes: 2