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!
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
}
Updated to swift 3.1:
There is no need to use WKInterfaceTable because now the function is located inside the UITableViewController.
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let ren : Int = indexPath.row
print ("Row \(ren)")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With