我试图基于多个条件来隐藏ActionSheetRow,我试图设置一个if语句,但这不起作用。我想知道是否有人尝试过或遇到过这个问题?
<<< SwitchRow("switchRow"){
$0.title = "The switch to hide the row when on"
}
<<< ActionSheetRow<String>("number") {
$0.title = "How many sports will be played"
$0.hidden = $0.hidden = Condition.function(["switchRow"], { form in
return ((form.rowBy(tag: "switchRow") as? SwitchRow)?.value ?? false)
})
$0.selectorTitle = "How many sports will be played"
while i <= places.count{
choices.append("\(i)")
i += 1
}
$0.options = choices
}
<<< ActionSheetRow<String>("firstSport"){
$0.hidden = Condition.function(["playSport"], { form in
return ((form.rowBy(tag: "playSport") as? SwitchRow)?.value ?? false)
})
$0.title = "Which is the first sport"
$0.selectorTitle = "Which is the first sport?"
$0.options = ["NBA", "MLB", "NFL",]
}
<<< ActionSheetRow<String>("secondSport"){
$0.title = "Which is the second sport"
$0.selectorTitle = "Which is the second sport?"
$0.options = ["NBA", "MLB", "NFL"]
$0.hidden = Condition.function(["number"])
{ form in
if let section = form.rowBy(tag: "number") as? ActionSheetRow<String> {
if section.value == "1" {
return true
}
}
return false
}
}
如果开关打开或用户在“数字” ActionSheetRow中选择1,我希望隐藏“ secondSport” ActionSheetRow。这可能吗?
谢谢大家的反馈意见。