Search code examples
iosswiftwatchkit

Detect click on WKInterfaceLabel or WKInterfaceGroup in WatchKit


I'm displaying circular progress bar with a label like this:

enter image description here

and I achieve this by creating WKInterfaceGroup and set its image to the animated images, then I put centred WKInterfaceLabel. Now I want to present another view controller when user clicks on the label or on the circular progress bar. How to do this?


Solution

  • A WKInterfaceButton can have one of two content types: a label or a group. This means you can put your existing group inside a button and have the button trigger the desired action. You can change the button's content type in your storyboard.

    I'd suggest taking a look at the docs for WKInterfaceButton.