像这样做
@IBAction func playPauseAudioButton(sender: AnyObject) { let tapGesture = UITapGestureRecognizer(target: self, action: "normalTap:") let longGesture = UILongPressGestureRecognizer(target: self, action: "longTap:") tapGesture.numberOfTapsRequired = 1 sender.addGestureRecognizer(tapGesture) sender.addGestureRecognizer(longGesture) } func normalTap(sender : UIGestureRecognizer) { let recognizer: UIGestureRecognizer = sender let tag: Int = recognizer.view!.tag switch tag { case 1: // Do some action for button 1 print("1") case 2: print("2") case 3: print("3") case 4: print("4") case 5: print("5") case 6: print("6") default: print("Default") } } func longTap(sender : UIGestureRecognizer) { let recognizer: UIGestureRecognizer = sender let tag: Int = recognizer.view!.tag if sender.state == .Ended { print("UIGestureRecognizerStateEnded") //Do Whatever You want on End of Gesture } else if sender.state == .Began { print("UIGestureRecognizerStateBegan.") //Do Whatever You want on Began of Gesture } switch tag { case 1: // Do some action for button 1 print("1") case 2: print("2") case 3: print("3") case 4: print("4") case 5: print("5") case 6: print("6") default: print("Default") } }