在哪里可以找到针对watchOS 2的Taptic反馈API文档或功能? [英] Where to find Taptic feedback API documentation or capabilities for watchOS 2?

查看:83
本文介绍了在哪里可以找到针对watchOS 2的Taptic反馈API文档或功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用触觉反馈为watchOS 2构建应用程序感兴趣.当前,我没有Apple Watch,但是可以访问Apple Developer Program.我尝试查看 watchOS开发人员库

I'm interested in building an app for watchOS 2 using haptic feedback. Currently I do not have the Apple Watch, but I have access to the Apple Developer Program. I've tried looking at the watchOS Developer Library and watchOS 2 Release Notes.

我没有看到有关如何以编程方式访问Taptic引擎或在当前watchOS 2中能够访问的功能的任何提及.

I do not see any mention of how to access the Taptic engine programmatically or what it is capable of in the current watchOS 2.

我该如何以编程方式访问Taptic引擎或了解新的Taptic API的功能?

How can I access the Taptic engine programmatically or understand what the new Taptic API is capable of doing?

推荐答案

您可以在此处找到有关触觉反馈的Apple API文档:

You can find the Apple API documentations for the haptic feedback here:

https://developer.apple.com/documentation/watchkit/wkinterfacedevice

您将找到一个名为

- playHaptic:

因此,您需要调用此函数来播放相关的触觉.可以使用以下代码完成此操作:

So you need to call this function to play the related haptic. This can be done with the following code:

迅速:

WKInterfaceDevice.currentDevice().playHaptic(<#WKHapticType#>)

Objective-C:

Objective-C:

[[WKInterfaceDevice currentDevice] playHaptic:<#WKHapticType#>]

但是请注意,目前这些反馈尚无法在模拟器上进行测试(因为这些触觉反馈是由新的Taptic Engine产生的,除了真正的Apple Watch以外,其他任何设备都无法访问这些新的Taptic Engine),但是您可以对其进行测试如果有,请在真实的设备(安装了watchOS 2 beta)上进行.

Be aware though, for now these feedbacks are unavailable to test on the simulator (because these haptic feedbacks are produced by the new Taptic Engine which is not accessible from any other device than a real Apple Watch), but you can test it on a real device (with watchOS 2 beta installed) if you have one.

这些是您可以玩的触觉类型:

These are the types of haptic you can play:

   WKHapticType.Notification,
   WKHapticType.DirectionUp,
   WKHapticType.DirectionDown,
   WKHapticType.Success,
   WKHapticType.Failure,
   WKHapticType.Retry,
   WKHapticType.Start,
   WKHapticType.Stop,
   WKHapticType.Click 

这篇关于在哪里可以找到针对watchOS 2的Taptic反馈API文档或功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆