Reputation: 53
Swift - WatchKit: How to set background color for selected row on watch tables? thanks in advance
Upvotes: 0
Views: 88
Reputation: 100541
Make the background as Group
@IBOutlet weak var cellBackGroup: WKInterfaceGroup!
Then set
row.cellBackGroup.setBackgroundColor(UIColor.red)
You can keep a variable
var selectedIndex = 0
and implement delegate method
func table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int) {
selectedIndex = rowIndex
....
}
Upvotes: 1