Tuesday, April 7, 2015

Infinite NSScrollView

Milen Dzhumerov:

When we refer to infinity, what we mean is that in practical terms the user will never hit an edge. One way to achieve that would be to make the scrollable area as large as possible (max values of CGFloat). Unfortunately, such very large values end up producing jerky scrolling movements.

Another approach is to never let the user hit the edge of the scroll view. We can observe the position of the scroll area and if it gets too close to a particular edge, we can move it back to the center while also making any changes to ensure the onscreen contents do not change. This will create the illusion of an infinite scroll view – in practice, the user can just never hit the edge.

Comments RSS · Twitter

Leave a Comment