I have a UIScrollView that can be scrolled horizontally. The scrollable content is displayed in columns.
Is there a way to make the scrolling only move in stepped increments instead of pixels (i.e. move a column at a time).
Diagram:
I have a UIScrollView that can be scrolled horizontally. The scrollable content is displayed in columns.
Is there a way to make the scrolling only move in stepped increments instead of pixels (i.e. move a column at a time).
Diagram:
While I think paging is probably the right answer, it's not what you were asking, which was jerky scrolling (columns "at all times"). I believe you could provide a
-scrollViewDidScroll:
delegate and adjust contentOffset to the nearest column.Yup there is:
Check the UIScrollView for more information.
I suggest you may need to change your view structure to something like this:
Center the
UIScrollView
horizontally and make sure that theUIView
that contains theUIScrollView
has a width that is a multiple of the width of theUIScrollView
If you target iOS 5.0, you can use the new UIScrollViewDelegate method scrollViewWillEndDragging:withVelocity:targetContentOffset. This allows you to set the point where the scrolling animation will end after the user has stopped dragging the scroll view.