Search code examples
iosuibuttonuilabelwatchkit

How to update UI with WatchKit?


I created a sample watchkit app and I dragged a UIButton and UILabel into the storyboard app scene. I was able to hook up the UIButton to the interface controller and got it to update the UILabel.

But the label.text was not reflected in the simulator. Nothing changes. Do I have to call something to update the UI?

I have made sure to connect both the UILabel and UIButton to variables in the controller.


Solution

  • To update a WKInterfaceLabel's text property you need to use setText():

    self.myLabel.setText("new text")