【发布时间】:2016-04-23 15:21:57
【问题描述】:
如何使用 Siri 遥控器访问播放/暂停按钮并覆盖菜单按钮?我目前正在使用它,但它对我不起作用。当我使用此代码时,我的程序崩溃了,但只有当我将其称为四个示例时才按下暂停按钮 编码器当前位于 touchesBegan 旁边的 didMoveToView 下方
let tapGesture = UITapGestureRecognizer(target: self, action: "handleTap:")
tapGesture.allowedPressTypes = [NSNumber(integer: UIPressType.Menu.rawValue)]
self.view.addGestureRecognizer(tapGesture)
【问题讨论】:
-
Apple 的 Swift 示例:Using Gesture Recognizers.
-
@DanielStorm 我已经尝试过了,但它使应用程序崩溃
-
你的
handleTap:函数是什么样的? -
func tapped(){ print("check") }
标签: swift tvos uitapgesturerecognizer siri-remote