2016-11-15 5 views
-1

Ошибка сохраняется даже при изменении нового синтаксиса swift3.0, например, удаления префиксов NS и других. Ошибка говоритОшибка Swift 3 с tableView

нельзя назвать значение типа без функции UITableView

Я рад, если я мог бы намек на решение этой проблемы.

 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: IndexPath) -> UITableViewCell { 

       let cell = super.tableView(tableView, cellForRowAtIndexPath: indexPath) 
       return cell 
     } 

ответ

1
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
     let cell = tableView.dequeueReusableCell(withIdentifier: "cartcel", for: indexPath) as! cartTableViewCell // My custom tableview cell class 
     cell.productName.text = Addtocartdata[indexPath.row].cartproName 
     cell.productQty.text = Addtocartdata[indexPath.row].cartproPrice 
     cell.productAmount.text = Addtocartdata[indexPath.row].cartproPrice 
     return cell; 
} 
+0

Фактически у меня нет каких-либо пользовательских ячеек. – ucb

+0

ok, тогда просто получите доступ к этому тегу и, наконец, пусть cell = tableView.dequeueReusableCell (withIdentifier: «cartcel», для: indexPath) как! UITableViewCell –

+0

функ Tableview (Tableview: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { пусть клеток = tableView.dequeueReusableCellWithIdentifier ("Songcell", forIndexPath: indexPath) пусть EventName: UILabel = (cell.viewWithTag (7), как! UILabel) eventname.text = songnamearray.objectAtIndex (indexPath.row) как? Строка возвращения клетки } Вот ответ на быстрый 2.0 и Xcode 7.3 –

2

Вы должны вернуть клетку, потому что cellforRowAtIndexPath не является недействительной функция:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: IndexPath) -> UITableViewCell { 

    let cell = super.tableView(tableView, cellForRowAtIndexPath: indexPath) 

    return cell 
} 
+1

спасибо за ответ на но я имел обратный элемент. – ucb

Смежные вопросы