Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Set any value in 'minimumPressDuration' of UILongPressGestureRecognizer #55

Open
t-kitamura opened this issue Dec 23, 2016 · 2 comments

Comments

@t-kitamura
Copy link

Hello ,

I want to set any value in 'minimumPressDuration' of UILongPressGestureRecognizer.
But, I do not have a better idea.

Can you add this feature?

@abhisheksingh1
Copy link

abhisheksingh1 commented May 3, 2017

 // gesture recognizers
fileprivate func setUpGestureRecognizers() {
    guard let collectionView = collectionView else { return }
    guard longPress == nil && panGesture == nil else {return }
    longPress = UILongPressGestureRecognizer(target: self, action: #selector(RAReorderableLayout.handleLongPress(_:)))

    self.longPress?.minimumPressDuration = 0.001


    panGesture = UIPanGestureRecognizer(target: self, action: #selector(RAReorderableLayout.handlePanGesture(_:)))
    longPress?.delegate = self
    panGesture?.delegate = self
    panGesture?.maximumNumberOfTouches = 1
    let gestures: NSArray! = collectionView.gestureRecognizers as NSArray!
    gestures.enumerateObjects(options: []) { gestureRecognizer, index, finish in
        if gestureRecognizer is UILongPressGestureRecognizer {
            (gestureRecognizer as AnyObject).require(toFail: self.longPress!)
        }
        collectionView.addGestureRecognizer(self.longPress!)
        collectionView.addGestureRecognizer(self.panGesture!)
        }
    }

open func cancelDrag() {
    cancelDrag(nil)
}

@ThuggishNuggets
Copy link

Yeah, this really should be configurable.

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

No branches or pull requests

3 participants