我正在尝试创建一个包含不同行数的部分的表格。我看到了这里给出的解决方案 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
类型。
任何人都可以发现哪里做错了吗?
最佳答案
看起来 teamSection
不是有效的行类型。您确定已在 Storyboard 中设置了包含两行的表格并将其中一行的标识符正确设置为“teamSection”吗?
关于ios - WKInterfaceTable 中的部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29181090/