Ios 使用Eureka单击单元格后如何执行条件

Ios 使用Eureka单击单元格后如何执行条件,ios,swift,eureka-forms,Ios,Swift,Eureka Forms,我正在使用下面的代码: <<< ButtonRow("MyCell") { $0.title = $0.tag $0.presentationMode = .segueName(segueName: "ShowMyScreen", onDismiss: nil) } 使用.onCellSelection闭包 您需求的示例代码 <<< ButtonRow("MyCell") { $0.title = $0.tag }.onCel

我正在使用下面的代码:

<<< ButtonRow("MyCell") { $0.title = $0.tag $0.presentationMode = .segueName(segueName: "ShowMyScreen", onDismiss: nil) }

使用
.onCellSelection
闭包

您需求的示例代码

<<< ButtonRow("MyCell") { $0.title = $0.tag
                }.onCellSelection({ (cell, row) in
                    if(yourCondition)
                    {
                       self.performSegue(withIdentifier: "ShowMyScreen", sender: nil)
                    }else{
                        let alert = UIAlertController(title: "test", message: "test", preferredStyle: .alert)
                        let action = UIAlertAction(title: "OK", style: .default, handler: { (action) in
                            self.performSegue(withIdentifier: "ShowMyScreen", sender: nil)
                        })
                        let action2 = UIAlertAction(title: "Cancel", style: .default, handler: nil)
                        alert.addAction(action)
                        alert.addAction(action2)
                        self.present(alert, animated: true, completion: nil)
                    }
                })

你能提供一些反馈吗?我的回答解决了你的问题吗?