首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WKInterfaceTable未加载值

WKInterfaceTable未加载值
EN

Stack Overflow用户
提问于 2018-09-11 17:11:10
回答 1查看 87关注 0票数 0

我正在从iOS应用程序的上下文中加载接口表的值。数据传递成功,但tableview方法

代码语言:javascript
复制
rowController(at: index)

返回nil值,并且在代码行之后numberOfRows变量仍为0

代码语言:javascript
复制
tableView.setNumberOfRows(3, withRowType: "deviceRow")

我的整体代码是

代码语言:javascript
复制
func setupTable() {
    tableView.setNumberOfRows(devicesArray.count, withRowType: "deviceRow2")

    for (index, device) in self.devicesArray.enumerated() {
        if let row = tableView.rowController(at: index) as? MeasurementCell {

            row.deviceNameLabel.setText(device)
            row.readingLabel.setText(self.readingsArray[index])
            let statusColor = colorWithHexString(hex: self.colorsArray[index])
            // row.backgroundGroupView.setBackgroundColor(statusColor.withAlphaComponent(0.2))
            row.readingLabel.setTextColor(statusColor)
            row.dateLabel.setText(self.datesArray[index])
            row.readingLabel.setTextColor(self.getColor(fromString: self.colorsArray[index]))
            row.readingLabel.sizeToFitWidth()
        }
    }

是否有解决此问题的方法?建议被高度评价。

EN

回答 1

Stack Overflow用户

发布于 2018-09-12 11:32:49

在interfaceController的身份检查器中

确实是

当我按如下所示进行更改时,苹果魔术起作用了。

不知道这个修复是如何工作的。希望将来的任何人都能帮助回答这个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52272519

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档