Ios didSelectRowAtIndexPath不工作,Swift 3

Ios didSelectRowAtIndexPath不工作,Swift 3,ios,swift,xcode,uitableview,Ios,Swift,Xcode,Uitableview,有人知道为什么DidSelectRowatineXpath不会被调用吗?我已经在代码和情节提要中由代表进行了三次检查 class AddCard: UIViewController,UIPopoverPresentationControllerDelegate, UITableViewDataSource, UITableViewDelegate { @IBOutlet weak var cardView: UIView! @IBOutlet weak var tableView: UITab

有人知道为什么DidSelectRowatineXpath不会被调用吗?我已经在代码和情节提要中由
代表
进行了三次检查

class AddCard: UIViewController,UIPopoverPresentationControllerDelegate, UITableViewDataSource, UITableViewDelegate {

@IBOutlet weak var cardView: UIView!
@IBOutlet weak var tableView: UITableView!

let tableItems = ["Background Color","Background Image","Font Style","Font Color"]
let cellID = "cell"

override func viewDidLoad() {
    super.viewDidLoad()

    tableView.delegate = self
    tableView.dataSource = self
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func setBackgroundColor (_ color: UIColor) {
    cardView.backgroundColor = color
}

func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

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

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath as IndexPath)

    let row = indexPath.row
    cell.textLabel?.text = tableItems[row]

    return cell
}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath) {
    tableView.deselectRow(at: indexPath as IndexPath, animated: true)
    print(indexPath.row)
    let row = indexPath.row
    switch(row){
    case 0:
        let popoverVC = storyboard?.instantiateViewController(withIdentifier: "colorPickerVC") as! ColorPickerViewController
        popoverVC.modalPresentationStyle = .popover
        popoverVC.preferredContentSize = CGSize(width: 284, height: 446)
        if let popoverController = popoverVC.popoverPresentationController {
            popoverController.sourceView = self.view
            popoverController.sourceRect = CGRect(x: 0, y: 0, width: 85, height: 30)
            popoverController.permittedArrowDirections = .any
            popoverController.delegate = self
            popoverVC.delegate = self
        }
        present(popoverVC, animated: true, completion: nil)
        break
    default: break

    }
}

}

Swift 3修改了方法的签名(也有很多方法,新的“规则”/样式)

替换:
func tableView(tableView:UITableView,didSelectRowAtIndexPath:indepath)
with
func tableView(tableView:UITableView,didSelectRowAt indexPath:indexPath)

请注意
\uu
didSelectRowAt
vs
didSelectRowAtIndexPath
,就像您更新的其他文件一样(它们也采用了相同的“样式”),但不是这个文件


删除该行并让XCode执行自动完成。否则,您可以将其替换为文档中的

您没有将
didSelectRowAtIndexPath:
的签名更新为Swift 3。从doc:
可选func tableView(\utableview:UITableView,didSelectRowAt indexath:indexPath)
中,注意
\ucode>与
didSelectRowAt
相比,didselectrowatinexpath
与您更新的另一个类似,但与此不同。删除该行并让XCode执行自动完成。否则,你可以用医生给你的替换掉。杀了它!谢谢,伙计,谢谢!到底为什么。。。。是因为当他们决定重命名每个新版本swift中的所有内容时,当您键入不推荐使用的名称时,xcode编辑器不会建议使用新名称。我只是在学习xcode和swift,我被这是多么糟糕的开发者体验所困扰。