2016-10-20 7 views
4

はここでエラーが表示されている私のコードです: エラーが3行にある「indexpath許可すれば...」メンバー 'tableView(_:numberOfRowsInSection :)'へのあいまいな参照なぜこのエラー?

override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
    if segue.identifier == "show Detail" { 
     if let indexPath = self.tableView.indexPathForSelectedRow { 
      let taakDetail : Taak = taken[(indexPath as NSIndexPath).row] 
      let controller = (segue.destination as! UINavigationController).topViewController as! DetailsViewController 
      controller.selectedTaak = taakDetail 
     } 
    } 

私はこのことについてあいまいであるかを調べることができません。それが参照するコードは次のとおりです。

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
    return taken.count 
} 
+1

変数の定義方法を教えてください。 – Sulthan

+1

[取得中にエラーが発生する可能性がありますtableView(\ _:numberOfRowsInSection:)の曖昧な使用](http://stackoverflow.com/questions/32396838/getting-error-ambiguous-use-of-tableview-numberofrowsinsection) – alexburtnik

+0

私のIBOutlet = '@IBOutlet weak tableview:UITableView! ' –

答えて

4

それはtableViewを見つけていないので、あなたが何らかの形で(もちろん、そうでないもの)、このメソッドを参照するためのものと仮定すると、オフに投げています。

注:コンセントはtableviewで、tableViewではありません。プロパティは大文字と小文字が区別さ

override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
    if segue.identifier == "show Detail" { 
     if let indexPath = self.tableview.indexPathForSelectedRow { 
      let taakDetail : Taak = taken[indexPath.row] 
      let controller = (segue.destination as! UINavigationController).topViewController as! DetailsViewController 
      controller.selectedTaak = taakDetail 
     } 
    } 
} 
+1

ありがとう、これは私の問題でした。それは今働く –

関連する問題