O'Reilly logo

Developing for Apple Watch by Jeff Kelley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying Tables

Whereas setting up a table’s contents in WatchKit is markedly different from using UITableView on iOS, modifying the content once we’ve done that initial setup is pretty similar—we just need to tell the table where to add the rows. To support what we’re going to do in the next chapter,, let’s include support for adding a new run to the table once we’ve set everything up.

We’ll use the interface controller’s awakeWithContext method to receive the data. When we get a Run passed in as the context, we’ll use the table’s insertRowsAtIndexes(_:withRowType:) method to add the row. We’ll then use its rowControllerAtIndex just like when we set up the table, but this time just for the newly inserted row. Our method will look like this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required