我希望通过播放音乐来实现这些耳机硬件按钮功能有所帮助:
答案 0 :(得分:0)
对于水龙头的数量。在viewDidload中实现此代码
override func viewDidLoad() {
super.viewDidLoad()
yourButton.addTarget(self, action: #selector(multipleTap(_:event:)), for: UIControlEvents.touchDownRepeat)
}
然后创建此功能:
@objc func multipleTap(_ sender: UIButton, event: UIEvent) {
let touch: UITouch = event.allTouches!.first!
if (touch.tapCount == numberOfClicks) {
// do stuff here
}
我希望帮助=)