RAReorderableLayout icon indicating copy to clipboard operation
RAReorderableLayout copied to clipboard

Set any value in 'minimumPressDuration' of UILongPressGestureRecognizer

Open t-kitamura opened this issue 8 years ago • 2 comments

Hello ,

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

Can you add this feature?

t-kitamura avatar Dec 23 '16 05:12 t-kitamura

 // 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)
}

abhisheksingh1 avatar May 03 '17 11:05 abhisheksingh1

Yeah, this really should be configurable.

ThuggishNuggets avatar Aug 28 '17 20:08 ThuggishNuggets