gpt4 book ai didi

ios - 反馈振动像苹果呼吸一样 swift

转载 作者:行者123 更新时间:2023-11-30 12:44:28 26 4
gpt4 key购买 nike

我试图在 iPhone 上重现 Apple Watch 的呼吸,但无法重现 watch 在呼吸时向用户提供的反馈振动。我尝试过这个:

for _ in 1...5 {
AudioServicesPlayAlertSound(SystemSoundID)
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
sleep(1)
}

但是振动太重,并且(由于 for 循环)不像 Apple Watch 那样流畅。

最佳答案

您可以简单地使用 Taptic 引擎来使用 Haptics,以获得更轻松的反馈。

swift 3

WKInterfaceDevice.current.playHaptic(.success)

Objective-C

[[WKInterfaceDevice currentDevice] playHaptic:WKHapticType.Success];

有关更多信息和可能的枚举值,请访问 here .

关于ios - 反馈振动像苹果呼吸一样 swift ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41805864/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com