ykyouhei / KYDrawerController

Side Drawer Navigation Controller similar to Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UIPageViewController inside KYDrawerController

schmidan opened this issue · comments

commented

Has anyone gotten this to work?

The UIPageViewController with UIPageViewControllerTransitionStyle.scroll and UIPageViewControllerNavigationOrientation.horizontal "steals" away the ScreenEdgePanGesture.

Does anyone know how to prevent this?
much obliged

commented

this issue can be closed

if anyone is interested.
the magic is in gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer)

i solved it by using my own subclass of KYDrawerController (could also be an extension but i need the subclass for other reasons as well)


class KYDrawerControllerTeamup: KYDrawerController {

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        guard let scrollView = otherGestureRecognizer.view as? UIScrollView else {
            return false
        }
        let needsToFail = scrollView.contentSize.height <= scrollView.frame.height
        return needsToFail
    }
}