ios - WKInterfaceTable 中的部分

标签 ios swift watchkit sections wkinterfacetable

我正在尝试创建一个包含不同行数的部分的表格。我看到了这里给出的解决方案 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/

相关文章:

swift - 使用带绑定(bind)的 ForEach 循环会导致数组缩小时索引超出范围(SwiftUI)

ios - Apple Watch 应用检测 Apple Watch 是否与手机配对

ios - iTunes Connect 预发布内部版本号警告符号

ios - 如何判断Apple Watch型号?

swift - Apple Swift - 检查字符串中是否存在字符

ios - 异步函数不更新变量

ios - 由于手机内存不足,下载文件失败时出现 URLSession 错误

ios - 如何使用 NSSet 填充 tableView? ( swift )

objective-c - iOS:如何保存在应用程序中创建的自定义对象

ios - Xcode Storyboard : Internal error. 请提交错误