0

我从 Internet 从 NSURL 加载数据并通过 WKInterfaceTable 显示数据。我的表有大约 82 行,每行内都有文本。当我运行代码时,我的表格会逐行显示数据,大约需要 2 - 3 秒才能显示表格上的所有数据。我有一个功能可以在用户按下一行时显示新的 WKInterface:

override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {

    self.pushControllerWithName("detail", context: nil)
}

但是我遇到了一个问题,如果我在我的表尚未加载所有数据时按下该行,我的应用程序将不会推送“详细信息”WKInterface。当我的表格显示所有数据时,我必须等待 2-3 秒,然后每个函数都可以正常工作。当我的表格显示数据时,如何调用该函数来推送详细信息 WKInterface?

4

2 回答 2

0

You can put the loading function in - (void)willActivate. Make sure that “Hides when Loading” is checked on the Storyboard. This will show a spinner that won't go away until you've left the method.

For a better user experience, I'd suggest displaying a Modal WKInterfaceController that blocks the UI while the information is loading. Also, try to limit how many rows are needed.

enter image description here

于 2015-04-20T21:11:03.563 回答
0

我使用 dispatch_assync 将 WKInterface Table 上的加载数据移动到另一个线程,并且该方法工作正常。

于 2015-04-21T06:11:10.620 回答