ariok / BWWalkthrough

BWWalkthrough is a simple library that helps you build custom walkthroughs for your iOS App
MIT License
2.76k stars 246 forks source link

Scrolling forward only #106

Closed objectivechris closed 7 years ago

objectivechris commented 7 years ago

Is there a way to prevent a user from scrolling backwards? I want it to go only go forward.

ariok commented 7 years ago

Hello this feature is not available. You could just disable user interaction for the scrollview and remove the "previous page" button.

nighthawk commented 7 years ago

You might be able to do this by adjusting the content size and content offset. You'll then even get the nice bouncy effect. I did a similar thing in a project where we temporarily disable scrolling to the next page until a certain action is taken:

        guard let originalSize = self?.originalContentSize, let scrollView = self?.scrollview else { return }
        if nextEnabled {
          scrollView.contentSize = originalSize
        } else {
          var contentSize = originalSize
          contentSize.width = CGFloat(page.rawValue + 1) * scrollView.frame.width
          scrollView.contentSize = contentSize
        }

Disabling the previous page would be more elaborate though as you'd have to change the offset, too, which might mess with the internals of BWWalkthroughViewController.

ariok commented 7 years ago

I'm closing the issue since is not going to be included in the next releases.