Методы UItableview, не вызываемые в XIB - PullRequest
0 голосов
/ 27 декабря 2018

Я пытаюсь использовать три таблицы в XIB.Я создал пользовательский класс UITableViewCell, однако, когда я пытаюсь его использовать, появляется сообщение об ошибке: «Неожиданно обнаружен ноль при развертывании необязательного значения».Я пытался зарегистрироваться

 internal func tableView(_ tableView: UITableView, cellForRowAt 
indexPath: IndexPath) -> UITableViewCell{


    if tableView == resultsTable {
    if savedWheelsArray.count > 0 {
        self.resultsTable.register(accessoryCellTableViewCell.self, forCellReuseIdentifier: "accessoryCell")
        let cell = tableView.dequeueReusableCell(withIdentifier: "accessoryCell" , for: indexPath) as! accessoryCellTableViewCell

        //let wheel = savedWheelsArray[indexPath.row]
        cell.AccessoryTitle.text = "WTF"
        cell.AcessoryImage.image = UIImage(named: "history")

    print("set up searched wheels cell")
    return cell
    }
        else {
            let cellIdentifier : String = "accessoryCell"
            let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! accessoryCellTableViewCell

            cell.AccessoryTitle.text = "no saved wheels"
            cell.AcessoryImage.image = UIImage(named: "history")
       print("no saved wheels found")
        return cell
    }
    }
    else {

    }
    return UITableViewCell()
    }
...