cell 的数据( 包含label,button等控件)总是为nil

Ansersion Ansersion 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

// Table view cells are reused and should be dequeued using a cell identifier.

guard let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as? ScanResultTableViewCell else {
fatalError("The dequeued cell is not an instance of ScanResultTableViewCell.")
}

// Fetches the appropriate meal for the data source layout.
let cellData = scanResults[indexPath.row]

cell.scanResultNameLabel?.text = cellData.deviceName
cell.scanResultLogoImageView?.image = cellData.logo
return cell

}


debug查看结果,发现cell.scanResultNameLabel为nil,可是我在storyboard明明在cell中拖进了一个label,求教大神?
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
Ansersion
Swift 1,423 成员 427 内容