0
這裏是我自定義的TableViewController
類。不調用自定義TableViewController tableView()方法
我插入打印語句在viewDidLoad
和tableView
方法
viewDidLoad
被打印到控制檯,但tableView
不是
我確信添加標識Device Cell
的屬性編輯器,所以我不肯定我做錯了什麼
class MyTableViewController: UITableViewController {
// ... some code
override func viewDidLoad() {
super.viewDidLoad()
print("viewDidLoad")
}
// ... some code
override func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell =
tableView.dequeueReusableCell(
withIdentifier: "Device Cell", for: indexPath)
// Configure the cell...
print("tableView")
let device = mWifiDevices[indexPath.row]
cell.textLabel?.text = device.mIpAddress
return cell
}
// ... some code
}
你有任何單元嗎?向我們展示一個代碼,您可以在其中設置其中應該有多少人的代碼 –
@Lu_您說得對,我忘了這麼做! –
你重新加載UITableView?怎麼樣設置tableView中的項目數量? – Jay