简体   繁体   中英

Why does method rowControllerAtIndex of WKInterfaceTable return nil?

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?

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.

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.

在此输入图像描述

To solve you have to set the row controller's identifier in the Attributes Inspector: 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM