iDevelopper / PBRevealViewController

A UIViewController subclass for revealing a left and/or right view controller above or below a main view controller.
MIT License
80 stars 16 forks source link

Disable panning #37

Closed Isuru-Nanayakkara closed 6 years ago

Isuru-Nanayakkara commented 6 years ago

Hi,

Is there a way to disable opening the side menu by panning? I tried setting the property panFromLeftBorderWidth to 0 but that didn't do anything.

iDevelopper commented 6 years ago

Hi,

No, this property works if the value is > 0

    /**
     The default border width allowing pan gesture from right. If > 0.0, this is the acceptable starting width for the gesture.
     */
    open var panFromRightBorderWidth: CGFloat = 0.0

Try with leftViewRevealWidth = 0

You can also implement the delegate function:

    /**
     Implement this to return NO when you want the pan gesture recognizer to be ignored.

     See also:

        panGestureRecognizer

     - Parameters:
        - revealController: The reveal view controller object.
        - direction:        The panning direction.

     - Returns:
        false if you want the pan gesture recognizer to be ignored, true otherwise.
     */
    @objc optional func revealControllerPanGestureShouldBegin(_ revealController: PBRevealViewController, direction: PBRevealControllerPanDirection) -> Bool
Isuru-Nanayakkara commented 6 years ago

Setting leftViewRevealWidth tp 0 did not work. However implementing that delegate method did. Thank you.