5

just a quick question if this is possible at all: can I create WKInterfaceButton elements for the AppleWatch programmatically? Or do I have to layout everything in InterfaceBuilder and cannot dynamically add UI elements on the watch?

So far I haven't found anything like this for the AppleWatch with watchOS 2 and I am unclear about the documentation.

Thanks for any insights.

Community
  • 1
  • 1
Christoph Eicke
  • 1,134
  • 7
  • 15

1 Answers1

4

You cannot create WKInterfaceObjects programmatically and add them to the view hierarchy. The only exception being WKInterfaceControllers that you can push / present programmatically (although you still have to add them to the storyboard first)

joern
  • 27,354
  • 7
  • 90
  • 105
  • OK thanks, that's a downer. I wanted to represent a list of buttons in the UI that I get from the iPhone's App and that can be configured there. As a workaround I will now use a `WKInterfacePicker` and then see which item was selected to segue to the next view. – Christoph Eicke Oct 28 '15 at 21:36
  • 3
    Can't you use an `WKInterfaceTable` for that? – joern Oct 28 '15 at 21:57
  • Wow, yes, I didn't know about `WKInterfaceTable` yet. Thanks! – Christoph Eicke Oct 29 '15 at 07:51