1

当您使用 Objective-C 和 Xcode 按下按钮时,如何在 Apple Watch 上进行触觉播放。

4

2 回答 2

6

目标-C:

[[WKInterfaceDevice currentDevice] playHaptic:WKHapticType.Success]

迅速:

WKInterfaceDevice.currentDevice().playHaptic(.Success)

您可以玩的触觉类型:

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

文档: https ://developer.apple.com/library/prerelease/watchos/documentation/WatchKit/Reference/WKInterfaceDevice_class/index.html#//apple_ref/occ/cl/WKInterfaceDevice

于 2016-01-24T21:30:36.027 回答
3

至少在objective-c的Xcode 11中你会做(Xcode 11)

 [[WKInterfaceDevice currentDevice] playHaptic: WKHapticTypeSuccess];
于 2019-09-06T20:36:34.087 回答