0
votes

I have 5 views (view 1, view 2, view 3, view 4, view 5) in a UIScrollView that are snapped to by finger swipes.

Problem: If I set pagingEnable = YES, I can't scroll more than 1 View. When I set pagingEnable = NO, scroll didn't centered current view.

Task: I need to control a scroll through all views by my finger and

  • if I tap on view
  • if I stop scrolling
  • if scroll stops by himself I need current view centered like if pagingEnable was YES.

I found this answers, but it did not really help.

PagingEnabled for multiple pages in UIScrollView

How can I let UIScrollView (pagingEnabled) to move 1.2 page each time?

1

1 Answers

1
votes

You should look at implementing the delegate callback for:

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
  *targetContentOffset = // calculate the required offset to have the scrollview centered
}