[英]Ambiguous reference to member 'tableView(_:numberOfRowsInSection:)' Why this error?
Here is my code in which the error appears: The error is in line 3 'if let indexpath...' 这是我的代码,其中出现错误:错误在第3行'如果让indexpath ...'
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
}
}
I can't find out what is ambiguous about this. 我无法找出这个含糊不清的东西。 The code to which it refers to is:
它所引用的代码是:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return taken.count
}
It's not finding tableView
, and is therefore getting thrown off, assuming you somehow meant to reference this method (which you don't, obviously). 它没有找到
tableView
,因此被抛弃,假设你以某种方式意味着引用这种方法(显然你不这样做)。
Note, your outlet is tableview
, not tableView
. 请注意,您的插座是
tableview
,而不是tableView
。 Properties are case sensitive. 属性区分大小写。
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
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.