1

After adapt data array to table, i get this error : libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) enter image description here I read this question but it seem not be my answer. Swift: Terminating with uncaught exception of type NSException

My storyboard like this: enter image description here

And this is my code of tableview :

class MenuTableViewController: UITableViewController {
    var menuList = ["Row1", "Row2", "Row3", "Row4"]
    override func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return menuList.count
    }
    override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        cell.backgroundColor = UIColor.clear   
    }
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "LabelCell", for: indexPath)
        cell.textLabel?.text = menuList[indexPath.row]
        return cell
    }

Please help me figure this out.

Community
  • 1
  • 1
Ryan Tran
  • 467
  • 6
  • 16

0 Answers0