如何禁用ImageCheckRow

时间:2017-06-13 06:01:37

标签: eureka-forms

我几天来一直在努力奋斗。我有一个ImageCheckRow类型列表,我想将它们标记为已选中或未选中,然后禁用它们,以便用户无法更改它们。 我执行了以下代码:

                            let multi = subvalue.extractBool("multi", ifnil: false)
                            let disableEntry = subvalue.extractBool("disabled", ifnil: false)
                            let title: String! = subvalue.extractString("title", ifnil: "Select")
                            let defaultValues = subvalue.extractNSDictionary("values");

                            let imageChecked: String!
                            let imageUnchecked: String!

                            if (multi)! {
                                currentSection = SelectableSection<ImageCheckRow<String>>(title, selectionType: .multipleSelection)
                                imageChecked = "images/checkbox-checked"
                                imageUnchecked = "images/checkbox-unchecked"
                            } else {
                                currentSection = SelectableSection<ImageCheckRow<String>>(title, selectionType: .singleSelection(enableDeselection: true))

                                // We should change these to radios at some point
                                imageChecked = "images/radio-checked"
                                imageUnchecked = "images/radio-unchecked"
                            }
                            form +++ currentSection!

                            if let options = subvalue.extractArray("options") {
                                for option in options {
                                    for (optionKey, optionValue) in option as! NSDictionary {

                                        currentSection! <<< ImageCheckRow<String> { row in
                                            row.tag = "\(tagname)_\(optionKey)"
                                            row.title = optionValue as? String
                                            row.selectableValue = optionKey as? String

                                            if let dvkey = optionKey as? String {
                                                if let _ = defaultValues?.value(forKey: dvkey) {
                                                    row.value = optionKey as? String
                                                }
                                            }

                                            row.disabled = Condition(booleanLiteral: disableEntry!)
                                            row.evaluateDisabled()

                                        }.cellSetup { cell, _ in
                                            cell.trueImage = UIImage(named: imageChecked)!
                                            cell.falseImage = UIImage(named: imageUnchecked)!
                                        }
                                    }
                                }
                            }

当&#39; disableEntry&#39;是的,ImageCheckRow对于单击仍然有效,并且图像从选中变为未选中,反之亦然。我应该如何禁用这些行?

1 个答案:

答案 0 :(得分:1)

尝试指向master中的最新提交。

这是Eureka的一个问题,在3.0.0发布后解决了。它在PR#1063 https://github.com/xmartlabs/Eureka/pull/1063

中得到了解决
相关问题