ios - AppleWatch:Digital Crown 触觉反馈
问题描述
我正在构建WathcOS 应用程序。有一个只有标签的简单视图。当用户滚动 Digital Crown 时,我想更改标签文本。
在我的 WKInterfaceController 我做了
crownSequencer.delegate = self
crownSequencer.focus()
func crownDidRotate(_ crownSequencer: WKCrownSequencer?, rotationalDelta: Double) {
crownAccumulator += rotationalDelta
var crowAccumulatorDelta = 0.05
if let speed = crownSequencer?.rotationsPerSecond {
crowAccumulatorDelta = speed < 0.5 ? 0.05 : 0.01
}
if crownAccumulator > crowAccumulatorDelta {
crownAccumulator = 0.0
updateDistanceValue(distance + 0.1)
} else if crownAccumulator < -crowAccumulatorDelta {
crownAccumulator = 0.0
updateDistanceValue(distance - 0.1)
}
}
问题是我没有听到 Native Digital Crown Haptic 反馈,例如当您在 Watch Home 屏幕或任何其他应用程序上滚动它时。我可以手动添加触觉反馈,例如:WKInterfaceDevice.current().play(.click)
但这与 Scroll 触觉不同。如何打开滚动触觉?为什么它不起作用?
PS Haptic 在手表设置中打开。
解决方案
如果有人遇到同样的问题:无需在代码中做某事。它默认工作。为了使它起作用,手表设置的音量不应该是最小的。
推荐阅读
- python - Django Pagination - 如何减少显示链接的数量?
- python - Python出勤率计算器使用do while循环
- android - 在 mapbox 中使用移动相机移动符号
- go - 无法使用 JFrog Artifactory 将 GitHub 私有存储库代理为 Go Registry
- javascript - Javascript中的耳机上一个/下一个按钮事件检测
- android - 布局中奇怪的白色区域
- python - How can I find an element looping through a list of divs using Selenium?
- security - ANTLR4 : Does it write anything to local file system while lexing and parsing?
- c++ - Is it possible to use a smart ptr or boost intrusive ptr as the "void* tag" value in a gRPC async server written in C++
- java - JDK 11 PreMaster Secret debugging