我有子类UITableViewCell。在这里,我做了一个按钮的出口。当该按钮被点击时,它应该在不同的ViewController中执行一个函数。我曾经尝试这样做:如何在UITableViewCell中为不同的ViewController设置UIButton的IBAction?
override func awakeFromNib() {
super.awakeFromNib()
reloadTableView.addTarget(self, action: #selector(multiplayerChannelView.tappedOnReloadTableView), for: .touchUpInside)
}
然而,这种崩溃,出现此错误:
[test.CreateChannelCell tappedOnReloadTableView]:无法识别的选择发送到实例0x7fc1198b5200
的功能存在,没有错字。为什么这不起作用?这个问题看起来是一样的,只有它不是写在迅速3.0 How to set Action for UIButton in UITableViewCell
multiplayerChannelView是持有UITableView的viewcontroller。我用UITableViewCell subclassed得到了一个分离的.swift文件。
是'multiplayerChannelView'是你的控制器您身在何处的tableView填充数据? –
Yesssssssssssss – NoKey