iosswiftuitableviewwatchkitibaction

How can I capture a table row press action in Swift WatchKit?


I currently have a table with some dynamic rows. When I run the probject the rows display on the screen and even have a press animation but xcode won't let me wire up the table row as an IBAction to its controller. I can't use a segue in this instance, it needs to be like a button press but preferably on the whole table rown I'd rather not insert a button into it. Any help appreciated, thanks!


Solution

  • You want to override the table:didSelectRowAtIndex function. It is a method on WKInterfaceController.

    override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
        // Handle row selection
    }