I have a WKInterfaceTable
table view with a WKInterfaceButton
.
How can I add a target action to the button from the table view. As there is no tag property I am not able to handle it.
I have a WKInterfaceTable
table view with a WKInterfaceButton
.
How can I add a target action to the button from the table view. As there is no tag property I am not able to handle it.
If your WKInterfaceButton
is contained within a row controller, here is one method to determine which row's button was tapped:
WKInterfaceButton
to the row controller and use interface builder to connect the button's action to your row controller classWhen the button action is handled in the row controller, call the delegate method that you defined in your protocol. Something like:
- (void)rowController:(MyRowControllerClass *)rowController didSelectRowWithTag:(NSInteger)tag
Handle this delegate method in your interface controller to do whatever work is necessary.
I use this technique in my own Watch app, and it works very well.