Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to skip the last page with swipe. #173

Open
Attiv opened this issue Mar 20, 2017 · 3 comments
Open

How to skip the last page with swipe. #173

Attiv opened this issue Mar 20, 2017 · 3 comments

Comments

@Attiv
Copy link

Attiv commented Mar 20, 2017

Don't clicked the skip button.

@willc0de4food
Copy link

I'm looking for the same functionality. I've tried editing various lines of OnboardingViewController.m to dismiss the view controller to no avail.
To be clear, I would like to make it so if the user is on the last page and swipes, the onboarding closes.

@Attiv
Copy link
Author

Attiv commented Jun 15, 2017

@willc0de4food I used these:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    if ((self.pageControl.currentPage == (self.pageControl.numberOfPages - 1 )) && (fabs(scrollView.contentOffset.x - self.view.frame.size.width) / self.view.frame.size.width) > 0.15 ){
        if (self.skipHandler) {
            self.skipHandler();
        }
    }
}

@babbage
Copy link

babbage commented Oct 18, 2017

Swift subclass of OnboardingViewController to implement this:

class MyOnboardingViewController: OnboardingViewController {
    override func scrollViewDidScroll(_ scrollView: UIScrollView) {
        if (pageControl.currentPage == (pageControl.numberOfPages - 1)) && (fabs(scrollView.contentOffset.x - view.frame.size.width) / view.frame.size.width) > 0.15 {
            if skipHandler != nil {
                skipHandler()
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants