gpt4 book ai didi

ios - 如何让 Digital Crown 重新与 watchOS 4 配合使用

转载 作者:行者123 更新时间:2023-11-28 12:16:23 24 4
gpt4 key购买 nike

我有一个 watchkit 应用程序,可以通过设置来使用数字表冠

crownSequencer.delegate = self
crownSequencer.focus()

在我正在实现的接口(interface) Controller 的唤醒方法中:

class InterfaceController: WKInterfaceController, WKCrownDelegate 

在 watchOS 3 中,我的委托(delegate)方法执行得很好:

// called when the crown rotates, rotationalDelta is the change since the last call (sign indicates direction).
func crownDidRotate(_ crownSequencer: WKCrownSequencer?, rotationalDelta: Double) {

// do something important here...
}

升级到 watchos4 后,此功能失效。简单的重新编译和转换为 swift 4 没有帮助。

最佳答案

我可以通过简单地将 crownSequencer 代码移动到我的界面 Controller 的 willActivate 方法来解决这个问题:

override func willActivate() {
...

crownSequencer.delegate = self
crownSequencer.focus()
}

在我看来,如果过早设置焦点,watchOS 4 中的某些内容会偷走焦点(可能与我正在使用的 spritekit 相关?)。

希望这能为其他人节省一些时间!

关于ios - 如何让 Digital Crown 重新与 watchOS 4 配合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46388908/

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