gpt4 book ai didi

ios - 如何在 swift 3.0 中从 UITableViewCell 按钮单击添加弹出框转场?

转载 作者:行者123 更新时间:2023-11-30 12:07:18 25 4
gpt4 key购买 nike

Here i am using popover to a new ViewController from my UITableVIewCell button click but i am getting this error Main.storyboard: Couldn't compile connection: 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)
}

最佳答案

尝试

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)
}

但我认为这不是一个好方法,您应该创建一个处理此类交互的协议(protocol)。

关于ios - 如何在 swift 3.0 中从 UITableViewCell 按钮单击添加弹出框转场?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46525386/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com