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

Restrict swipe gesture to a certain area #16

Open
suprb opened this issue Sep 11, 2016 · 8 comments
Open

Restrict swipe gesture to a certain area #16

suprb opened this issue Sep 11, 2016 · 8 comments

Comments

@suprb
Copy link

suprb commented Sep 11, 2016

Is there any way to restrict the pan/swipe to a certain area? I'd like to leave the bottom part of my view as an area where it ignores the gesture. Is it doable?

@fortmarek
Copy link
Owner

Since SwipeViewController subclasses UIPageViewController it should be possible. Try looking at this code: https://gist.github.com/TosinAF/805a22ab5a3e4ffe17a8/

@relaxsus
Copy link

relaxsus commented Apr 6, 2018

Okay, but if I need tableView gestures to work? How realize it?

@fortmarek
Copy link
Owner

I have not tried this myself, but please do try to use the gist I shared above. You can implement part of it in SwipeViewController.swift syncScrollView() function. Any PRs are welcome 🤓

@relaxsus
Copy link

relaxsus commented Apr 6, 2018

In SwipeViewController.swift

    open var isSwiping = true

inside func setPageController()

    pageController.delegate = self
    if isSwiping {
            pageController.dataSource = self
    }

In YourViewController: SwipeViewController where you want to disable swipe

    isSwiping = false

@fortmarek
Copy link
Owner

Hmm, interesting solution, I will take a look at it tomorrow. This is for disabling swiping for one ViewController as a whole, and not a part of it, but still could be useful for some people out there! 🎊

@relaxsus
Copy link

relaxsus commented Apr 6, 2018

Yes, it is for disabling the whole ViewController. I needed just it:)

@SeasiaInhouse
Copy link

What if I want to disable swiping in ViewController: UIViewController not ViewController: SwipeViewController

@fortmarek
Copy link
Owner

@SeasiaInhouse, could you please describe your problem more thoroughly? Thanks.

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

4 participants