WatchKit-区分table中的table(table, didSelectRowAtIndex)

WatchKit-Distinguish among tables in table(table, didSelectRowAtIndex)

我的 WKInterfaceController 中有 2 个表。单击它们的行将推送到不同的 WKInterfaceController。我需要使用 override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) 因为我需要传递一个上下文对象。

如何判断单击了哪 WKInterfaceTable 行?

像这样:

override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
    // If condition A is satisfied
    {
        presentControllerWithName("WKControllerA", context: self)
    }
    else
    {
        presentControllerWithName("WKControllerB", context: self)
    }
}

只需像这样检查 tablerowIndex

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

    if table==myTable1 && rowIndex==myIndex {

            //do something

    } else if table==myTable2  && rowIndex==myIndex2  {

            //do something else

    }
}