3
我試圖在迅速的Xcode斯威夫特錯誤:類型的值「NSObject的 - >()‘AnimalListTableViewController’沒有成員‘的tableView’
擺脫這些錯誤的。如果截圖是太小,這裏是代碼
import UIKit
class AnimalListTableViewController: UITableViewController
{
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
let indexPath = self.tableView.indexPathForSelectedRow()//this is where the error appears, it says Value of type 'NSObject ->() -> AnimalListTableViewController' has no member 'tableView'
override func prepareForSegue(segue: UIStoryboardSegue,
sender: AnyObject?)
{
if let DetailViewController =
segue.destinationViewController
as? DetailViewController {
}
}
if let indexPath = self.tableView.indexPathForSelectedRow()
{
DetailViewController.Animal = animals[indexPath.row]
}
}