Den*_*nde 10 tableview ios swift3
这是我的代码,其中出现错误:错误在第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
}
}
Run Code Online (Sandbox Code Playgroud)
我无法找出这个含糊不清的东西.它所引用的代码是:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return taken.count
}
Run Code Online (Sandbox Code Playgroud)
Rob*_*Rob 11
它没有找到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
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8789 次 |
最近记录: |