How to get unlimited UIScrollView

I would like to be able to create a scroll that can scroll an unlimited (infinite) distance (this is the number one question how to do this with the contentSize property). The reason for this is because I can implement a scrollable calendar view that the user can use to scroll time along one axis.

Now I need to put there / a to mark the dates when they scroll. My second question is how to implement such a view in a scroll. I could have a long view, 3 or 4 times wider than the scrollview frame, and just change and update it every time the scroll stops, pretending to be a continuous bar. Any other ideas?

Thank!

+3
source share
4 answers

I know that some time has passed since you posted this question, but only for future reference:

At WWDC 2011, Apple presented an excellent presentation called "Session 104 - Advanced Scroll View Techniques." You can watch videos from developer.apple.com or from iTunes.

The basic concept:

1 - Start with a spy that is larger than your scrollView bounds.

2 - In -layoutSubViewsfrom scrollView, you check whether the contentOffset in the direction you want to scroll endlessly past the specific threshold that you specify (it should not be any specific value, it can be 1 point in an extreme case).

3 - , reset contentOffset , .

, . , scrollBar . scrollView , , scrollBars, , , .

+2

, ... CGSizeZero

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html#//apple_ref/occ/instp/UIScrollView/contentSize

   contentSize

    The size of the content view. @property(nonatomic) CGSize contentSize Discussion

    The unit of size is points. The default size is CGSizeZero.

: "" , ? .

? , ... , , , , .... , , .

0

- . - .

3 screen scrollview:

|---|---|---|
|   |   |   | 
|---|---|---|

3 , , , , . , , scrollview .

, , .

, . , .

0

Source: https://habr.com/ru/post/1733437/


All Articles