How do we use Watchkit Touch Events?

自古美人都是妖i 提交于 2019-12-11 02:52:27

问题


I wanna use touch events in my app. I know gesture recognisers can not be used in watchKit. Is it possible to use functions like touchesBegan, touchesMove etc ?


回答1:


A little late to the party, but it's possible to use SceneKit with WatchKit and SceneKit allows you to add gesture handlers. Please see the Apple example project here:

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

Edit: Looks like Tap, Swipe, Long Press and Pan gesture handles can be added to any view added to the InterfaceController.




回答2:


Apple Watch app uses WatchKit framework. UIKit events are not applicable here.

Alternate is to use forced touch event which triggers Context Menu (if available)

Instead of just tapping items on the screen, pressing the screen with a small amount of force activates the context menu (if any) associated with the current interface controller.




回答3:


There is no such an api like "touchesBegan" or "touchesMove".

The only thing you can do to respond to a button event is to use IBAction.



来源:https://stackoverflow.com/questions/27183746/how-do-we-use-watchkit-touch-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!