11

When I run the code below, the method rowControllerAtIndex of WKInterfaceTable returns nil.

[self.outletTable setNumberOfRows:numberOfCategoriesToShow withRowType:@"rowTypeLabel"];
RowControllerTypeLabel *theRow = [self.outletTable rowControllerAtIndex:rowInTable];

What I've checked:

  1. I have made the connection between the row in the storyboard and the corresponding property in the interface of RowControllerTypeLabel.
  2. I have set the field Custom Class of my label to my custom class RowControllerTypeLabel.
  3. I have also made the connection between the table in the storyboard and the corresponding property in the interface of my interface controller.

What am I missing?

John
  • 8,468
  • 5
  • 36
  • 61

3 Answers3

23

I forgot to set the row controller's identifier rowTypeLabel in the Attributes inspector.

I hope that this post will help others to find the problem in a shorter time than I needed.

John
  • 8,468
  • 5
  • 36
  • 61
  • 1
    If you have your row controller, but your outlets is nil -> Beware of using "reserved" names in your row controller, for example label with name `title` will bring you a lot of pain. It's not very straightforward that it's forbidden, since you create `NSObject` subclass. – Dima Deplov Feb 27 '17 at 12:44
  • If you are having trouble finding the Identifier field, like I was, make sure you have the actual Row Controller selected and not the Group, by selecting it from the Document Outline pane on the left. – Stefan S Oct 29 '18 at 04:33
6

For me - while the module was spelt out correctly - from copying and pasting of scenes / renaming classes - something went a miss and it was temporarily disconnected. I had to reselect the drop down for it to kick in.

enter image description here

Community
  • 1
  • 1
johndpope
  • 5,035
  • 2
  • 41
  • 43
5

To solve you have to set the row controller's identifier in the Attributes Inspector: enter image description here

Ricardo
  • 2,086
  • 25
  • 35