首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在快捷3.0中从UITableViewCell按钮中添加popover?

如何在快捷3.0中从UITableViewCell按钮中添加popover?
EN

Stack Overflow用户
提问于 2017-10-02 12:23:07
回答 1查看 290关注 0票数 0

在这里,我通过单击ViewController按钮对一个新的UITableVIewCell使用了弹出,但是我得到了错误Main.storyboard:无法编译连接: property=anchorView destination=>

代码语言:javascript
运行
复制
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)
}
EN

回答 1

Stack Overflow用户

发布于 2017-10-02 12:32:12

试一试

代码语言:javascript
运行
复制
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)
}

但是我不认为这是一个很好的方法,你应该创建一个处理这种交互的协议。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46525386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档