我在 WKInterfaceTable 中有一个组,并使用函数didSelectRowAtIndex来拦截行的选择并执行其他操作。一切都很好,除了当用户触摸该行时,我想更改它的 backgroundColor 并且我不知道如何实现这种行为。
函数的第一行如下所示:
override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
let slctedRow = self.mainTable.rowControllerAtIndex(rowIndex) as! MainTableRowController
slctedRow.rowMainGroup.setBackgroundColor(self.rowSelectedColor)
不幸的是,该行不会立即更改颜色,因为该函数不会立即调用,而是仅在用户释放触摸时调用。
有没有办法立即拦截触摸(从而改变组的背景颜色)?