Не удалось выполнить метод - ошибка: значение типа 'UITableViewCell' не имеет члена 'getCell' - PullRequest
0 голосов
/ 21 сентября 2018

Я пытаюсь вызвать метод func in cell, но перед этим мне нужно вызвать func в ячейке контроллера View.Каждый раз, когда я пытаюсь позвонить, Xcode не распознает его, и появляется ошибка.Если я просто скопирую его (значение типа 'UITableViewCell' не имеет члена 'getCell').

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell:TableViewCell1 = tableViewFullP1.dequeueReusableCell(withIdentifier: "cell01", for: indexPath) as! TableViewCell1

    configureCell(cell, at: indexPath) // The one I want to call in the end

    return cell
}

//Fetch Method P1
func fetchInfoToHomepage() {
    let fetchRequest88: NSFetchRequest<Information> = Information.fetchRequest()
    let sortOnDate = NSSortDescriptor(key: "date_info9", ascending: false)

    fetchRequest88.sortDescriptors = [sortOnDate]

    controllerItch = NSFetchedResultsController(fetchRequest: fetchRequest88, managedObjectContext: context77, sectionNameKeyPath: nil, cacheName: nil)
    controllerItch.delegate = self

    do {
        try controllerItch.performFetch()
    } catch {print("Failed fetch p1")}
}

// Sepcical func
func configureCell(_ cell: UITableViewCell, at indexPath: IndexPath) {
    var malekHosny = controllerItch.object(at: indexPath)
    cell.getCell(infos: malekHosny) //Here's the problem
}

1 Ответ

0 голосов
/ 21 сентября 2018

Предположительно, ваш подкласс UITableViewCell имеет метод getCell.Так что вам нужно привести к этому подклассу:

(cell as! TableViewCell1).getCell...
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...