2

我想在我的应用程序中使用触摸事件。我知道手势识别器不能在 watchKit 中使用。是否可以使用 touchesBegan、touchesMove 等功能?

4

3 回答 3

6

Apple Watch 应用使用WatchKit 框架。UIKit 事件在这里不适用。

替代方法是使用触发上下文菜单的强制触摸事件(如果可用)

不只是轻敲屏幕上的项目,而是用一点力按下屏幕会激活与当前界面控制器关联的上下文菜单(如果有的话)。

于 2014-11-28T08:30:05.990 回答
5

没有像“touchesBegan”或“touchesMove”这样的api。

响应按钮事件的唯一方法是使用 IBAction。

于 2014-12-03T22:54:31.063 回答
2

聚会有点晚了,但是可以将 SceneKit 与 WatchKit 一起使用,并且 SceneKit 允许您添加手势处理程序。请在此处查看 Apple 示例项目:

https://developer.apple.com/library/content/samplecode/WatchPuzzle/Introduction/Intro.html#//apple_ref/doc/uid/TP40017284-Intro-DontLinkElementID_2

编辑:看起来可以将点击、滑动、长按和平移手势句柄添加到添加到 InterfaceController 的任何视图中。

于 2017-02-06T19:48:19.477 回答