我正在尝试创建一个具有不同行数的部分的表。我在这里看到了How to create sections in WKInterfaceTable的解决方案,并尝试了如下方法:
tableView.setRowTypes(rowTypes);
for q in 0...rowTypes.count-1 {
if (rowTypes[q] == "teamSection") {
let row = tableView.rowControllerAtIndex(q) as? teamSection;
}
else {
let row = tableView.rowControllerAtIndex(q) as? teamRow;
}
}我的rowTypes如下:
let rowTypes = ["teamSection", "teamRow", "teamSection", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow"];我本来想要11行,但只得到9行,它们都是teamRow类型,而不是teamSection类型。有人能发现哪里出了问题吗?
发布于 2015-03-21 15:11:07
看起来teamSection不是一个有效的行类型。您确定您已经将情节提要中的表设置为两行,并将其中一行的标识符正确设置为"teamSection“吗?
https://stackoverflow.com/questions/29181090
复制相似问题