Restrict swipe gesture to a certain area
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?
Since SwipeViewController subclasses UIPageViewController it should be possible. Try looking at this code: https://gist.github.com/TosinAF/805a22ab5a3e4ffe17a8/
Okay, but if I need tableView gestures to work? How realize it?
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 🤓
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
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! 🎊
Yes, it is for disabling the whole ViewController. I needed just it:)
What if I want to disable swiping in ViewController: UIViewController not ViewController: SwipeViewController
@SeasiaInhouse, could you please describe your problem more thoroughly? Thanks.