vendredi 22 juillet 2016

pick up all UIGestureRecognizer events in callback?

Is there a way to pickup all UIGestureRecognizer events in one method? (besides via directing all their selectors to the same method).

So for example:

    // Add Gesture Recogniser (Long Press)
    let longPressGR = UILongPressGestureRecognizer(target: self, action: #selector(GcMapView.longPressAction(_:)))
    longPressGR.minimumPressDuration = 1
    self.addGestureRecognizer(longPressGR)

    // Add Gesture Recogniser (Pan)
    let mapDragRecognizer =  UIPanGestureRecognizer(target: self, action: #selector(GcMapView.panAction(_:)))
    mapDragRecognizer.delegate = self
    self.addGestureRecognizer(mapDragRecognizer)

    // Add Gesture Recogniser (Pinch)
    let pinchGestureRecogniser =  UIPanGestureRecognizer(target: self, action: #selector(GcMapView.pinchAction(_:)))
    pinchGestureRecogniser.delegate = self
    self.addGestureRecognizer(pinchGestureRecogniser)    

   // SOME METHOD NOW TO PICKUP ALL EVENTS
   func PICKUPALLEVENTS (sender:UIGestureRecognizer) {
       print("(String(gestureRecognizer.dynamicType) - (gestureRecognizer.state.hashValue) ")
   }  

Aucun commentaire:

Enregistrer un commentaire