0

Swift - WatchKit:如何为手表表上的选定行设置背景颜色?提前致谢

4

1 回答 1

1

将背景设为组

@IBOutlet weak var cellBackGroup: WKInterfaceGroup!

然后设置

row.cellBackGroup.setBackgroundColor(UIColor.red)

你可以保留一个变量

var selectedIndex = 0

并实现委托方法

func table(_ table: WKInterfaceTable,  didSelectRowAt rowIndex: Int) {
    selectedIndex = rowIndex
    ....
}
于 2022-01-26T09:31:40.547 回答