cell 的数据( 包含label,button等控件)总是为nil
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,求教大神?