0

Swift - WatchKit: How to set background color for selected row on watch tables? thanks in advance

Reza Kashkoul
  • 43
  • 2
  • 7

1 Answers1

1

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
    ....
}
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87