Я в основном хочу создать собственное представление и добавить в него табличное представление. Я могу сделать это успешно, и табличное представление также отображается правильно, когда я запускаю код. Но tablview отображается пустым, несмотря на регистрацию настраиваемой ячейки tablview в viewDidLoad
. Это настраиваемая ячейка tableview, которую я разработал для загрузки в tablview.
Созданный мной файл .swift пользовательского класса представления выглядит так ... 1007 *
В viewDidLoad
,
standardsProceduresView.delegate = self
standardsProceduresView.dataSource = self
standardsProceduresView.registerClass(cellClass: UpdatingListTableViewCell.self, forCellReuseIdentifier: "cellClass")
И далее,
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: UpdatingListTableViewCell = self.standardsProceduresView.dequeueReusableCellWithIdentifier(identifier: "cellClass") as! UpdatingListTableViewCell
cell.nameLbl.text = "MyName" //But here I get a crash saying 'Unexpectedly found nil while implicitly unwrapping an Optional value'
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}