在这里,我通过单击ViewController按钮对一个新的UITableVIewCell使用了弹出,但是我得到了错误Main.storyboard:无法编译连接: property=anchorView destination=>
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if(tableView == self.table_view_one) {
var cell = table_view_one.dequeueReusableCell(withIdentifier: "first_cell", for: indexPath) as! first_cell
cell.first_view_time_btn.addTarget(self, action: #selector(Iop_gonio_ViewController.someAction), for: .touchUpInside)
return cell
}
}
func someAction() {
self.performSegue(withIdentifier: "first_time_btn", sender: self)
}发布于 2017-10-02 12:32:12
试一试
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if(tableView == self.table_view_one) {
var cell = table_view_one.dequeueReusableCell(withIdentifier: "first_cell", for: indexPath) as! first_cell
cell.first_view_time_btn.addTarget(self, action: #selector(someAction(sender:)), for: .touchUpInside)
return cell
}
func someAction(sender:UIButton) {
self.performSegue(withIdentifier: "first_time_btn", sender: self)
}但是我不认为这是一个很好的方法,你应该创建一个处理这种交互的协议。
https://stackoverflow.com/questions/46525386
复制相似问题