简体   繁体   English

基于另一行的值的Swift Eureka ActionSheetRow选项

[英]Swift Eureka ActionSheetRow options based on the value of another row

I am attempting to have an ActionSheetRow, but I would like the options of this row to be based on the value selected on a different ActionSheetRow. 我正在尝试使用ActionSheetRow,但是我希望此行的选项基于在其他ActionSheetRow上选择的值。 I attempted on placing and if statement before the dependent ActionSheetRow but this did not work. 我试图在相关的ActionSheetRow之前放置if语句,但这没有用。 I also attempted to add an if statement before setting the options and this also did not work. 我还尝试在设置选项之前添加if语句,但这也行不通。 Is this something that is possible and if so how would I go about doing this? 这有可能吗?如果可以,我将如何去做?

Thank you all feed back welcome 谢谢大家反馈欢迎

In your setup closure of the ActionSheetRow you get the row you want to switch on, see: ActionSheetRow设置关闭中,您将获得要打开的行,请参见:

let row: RowOf<String>! = form.rowBy(tag: "Request")
let value = row.value ?? ""

if value == "1" {
  $0.options = ["A", "B"]
} else {
  $0.options = ["C", "D"]
}

That should work. 那应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM