问题
Wanna pass data from a ViewController which has TableView init, to another ViewController. But it's showing me the error "Ambiguous reference to member 'tableView(_:numberOfRowsInSection:)' "
@IBOutlet weak var completedCaseTableView: UITableView!
override func viewDidLoad() {
    super.viewDidLoad()
    completedCaseTableView.delegate = self
    completedCaseTableView.dataSource = self
    // Do any additional setup after loading the view.
}
public func numberOfSections(in tableView: UITableView) -> Int {
    return 1
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return usrNameList.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "CompletedCaseCell", for: indexPath) as! Admin_CompletedCases_TableViewCell
    cell.completedTktNum.text = usrTktList[indexPath.row]
    cell.completedUsrName.text = usrNameList[indexPath.row]
    cell.completedCustomerDp.image = UIImage(named: imageList[indexPath.row])
    cell.completedPostedDate.text = datesList[indexPath.row]
    cell.completedUsrReason.text = reasonList[indexPath.row]
    cell.statusOfCase.text = statusList[indexPath.row]
    return cell
}
public override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if (segue.identifier == "AdminCompletedDetailsSegue" ){
        let adminCompletedDvc = segue.destination as! Admin_Completed_Details_ViewController
        if let indexPath = self.tableView.indexPathForSelectedRow {
            adminCompletedDvc.newTktNumNew = usrTktList[indexPath.row] as String
            adminCompletedDvc.customerUsernameAdmnNew = usrNameList[indexPath.row] as String
            adminCompletedDvc.postedDateAdmnNew = datesList[indexPath.row] as String
            adminCompletedDvc.customerReasonAdmnNew = reasonList[indexPath.row] as String
            adminCompletedDvc.customerCommentsAdmnNew = commentList[indexPath.row] as String
            adminCompletedDvc.customerImgAdmnNew = imageList[indexPath.row] as String
        }
    }
}
    回答1:
The problem is that there is nothing in your view controller called self.tableView. Its name is completedCaseTableView. So change this:
if let indexPath = self.tableView.indexPathForSelectedRow {
to this:
if let indexPath = self.completedCaseTableView.indexPathForSelectedRow {
    来源:https://stackoverflow.com/questions/52863665/ambiguous-reference-to-member-tableview-numberofrowsinsection