简体   繁体   English

为什么WKInterfaceTable的方法rowControllerAtIndex返回nil?

[英]Why does method rowControllerAtIndex of WKInterfaceTable return nil?

When I run the code below, the method rowControllerAtIndex of WKInterfaceTable returns nil. 当我运行下面的代码时, rowControllerAtIndex的方法WKInterfaceTable返回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 . 我已经在故事板中的行与RowControllerTypeLabel接口中的相应属性之间建立了连接。
  2. I have set the field Custom Class of my label to my custom class RowControllerTypeLabel . 我已将标签的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. 我忘了在Attributes检查器中设置行控制器的标识符rowTypeLabel

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: 要解决此问题,您必须在Attributes Inspector中设置行控制器的标识符: 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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