How to implement a cyclic UIScrollView? That is to say, when you scroll to the very left item then the UIScrollView will show the very right one. Any help would be appreciate.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
Sure, you need three views. At any given time you have a left view, a right view and a current view.
This requires notification of each movement through the UIScrollViewDelegate.
If you detect that you moved right, you free left, make left = current, current = right, and make a new right.
If you detect that you moved left, you free right, make right = current, current = left, and make a new left.
Generally speaking, any view that is more than one page away from current is not required. So you need only three pages in total.
Of course you also need to manipulate the position of the UIScrollView so you can make the movements - the net result is you don't move although it looks like you have. When you have done the scroll, and altered the views according to the left/current/right shuffle - you do
so that you are always looking at the same actual page, with one page each side of it. When the scroll happens it looks like the user can keep scrolling around in a loop - but after each page ticks over, the views are shuffled, the position within the scroll view gets set back to the middle and the user can scroll again.
Getting back to the start is simply a matter of using the view related to whatever object is at the other end of whatever data structure you are using - so if
current = [(NSArray)data lastObject]
thenright = [(NSArray)data objectAtIndex:0]
.