我在准备潜在的 iWatch 应用程序时有一个问题。之前没有编写 iOS 应用程序的经验,API 感觉非常令人生畏且难以导航。
这个项目的核心部分包括向 iWatch 发送振动脉冲——这完全可能吗,或者我是否仅限于标准的“通知”振动?如果是这样,是否知道发送振动通知的频率是多少?
我在 StackO 上找到了一个可能的相关主题: Are there APIs for custom vibrations in iOS? 这种方法适用于 iWatch 应用吗?
提前谢谢你。
最佳答案
目前,自定义 触觉反馈没有 API。但从 watchOS 2.0 开始,您可以通过提供 WKHapticType
选项来调用触觉反馈。
WKInterfaceDevice.current().play(.success)
这里是 WKHapticType
选项:
enum WKHapticType : Int {
case Notification
case DirectionUp
case DirectionDown
case Success
case Failure
case Retry
case Start
case Stop
case Click
}
关于ios - WatchKit/苹果 watch API : vibrations of custom length?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27711983/