時,我的the main storyboard
設置爲table view
和prototype cell
,identifier
設置爲「單元格」。表格視圖有data source outlet
和delegate outlet
。
但是,當我在第11行創建表視圖時(見下面的代碼),我的構建每次都會因爲「未解析的標識符」而崩潰。TableViewCell未解決的標識符在我的Xcode項目中創建單元格
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource
{
let array = createArray()
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return(validDeck.count)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
cell = UITableViewCell(style: UITableViewStyle.default, reuseIdentifier: "cell") |"ERROR: Unknown Identifier 'cell' "
cell.textlabel?.text = ""
return cell
}
有沒有人知道這個錯誤,並願意幫忙?
不要使用括號,這不是一個功能,例如'return validDeck.count' – vadian