在多个条件下将Eureka隐藏行

问题描述 投票:1回答:1

我试图基于多个条件来隐藏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。这可能吗?

谢谢大家的反馈意见。

swift xcode eureka-forms
1个回答
0
投票
对您来说可能为时已晚,但是我会在这里发布,因为在其他地方找不到合适的答案。
© www.soinside.com 2019 - 2024. All rights reserved.