【问题标题】:WatchKit, should I be updating UI from ExtensionDelegate?WatchKit,我应该从 ExtensionDelegate 更新 UI 吗?
【发布时间】:2016-12-09 12:07:40
【问题描述】:

我正在使用 WatchConnectivity 在手机和手表之间传输数据。现在我在ExtensionDelegate+WCSessionDelegate.swift 文件中实现了didReceiveUserInfo。当我收到数据时,我需要通知我的 InterfaceController 手表已收到所需的数据并准备就绪。

由于didReceiveUserInfo 在 ExtensionDelegate 中,我如何让 InterfaceController 知道它已准备好开始做事?还是应该让 InterfaceController 成为 WCSessionDelegate?我正在阅读关于 WatchOS 的 Ray Wenderlich 的书,他们建议在 AppDelegate 的扩展中执行大多数类似的操作,或者在本例中为 ExtensionDelegate。

如果可以的话,代码示例会很酷!

谢谢。

【问题讨论】:

    标签: ios swift watchkit


    【解决方案1】:

    通过添加一个 NSNotifications 的观察者来解决它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-23
      • 1970-01-01
      • 2010-12-31
      • 1970-01-01
      相关资源
      最近更新 更多