2016-11-15 13 views
-1

NSプレフィックスなどを削除するなど、新しいswift3.0構文を変更してもエラーが発生し続けます。エラーがテーブルビューでSwift 3エラー

が、私はこの問題を解決するためのヒントを持っていることができればうれしい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"、for:indexPath)を! UITableViewCellの –

+0

のfuncのtableView(のtableView:のUITableView、cellForRowAtIndexPath indexPath:NSIndexPath) - : のlet eventnameに:UILabel =(cell.viewWithTag(7)のように>のUITableViewCell { セル= tableView.dequeueReusableCellWithIdentifier(indexPath "Songcell"、forIndexPath)しましょう! UILabel) eventname.text = songnamearray.objectAtIndex(indexPath.row)as?文字列 リターンセル } はここで何度も何度も尋ねるために、私の下手な説明のための迅速2.0のための答えとXcode 7.3 –

2

cellforRowAtIndexPathが非void関数であるので、あなたは、セルを返す必要があります答えるため

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

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

    return cell 
} 
+1

おかげで、私はリターンセルを持っていました。 – ucb

関連する問題