尤里卡-呈现PushRow时添加“无”行

时间:2019-01-11 10:58:08

标签: swift uitableview eureka-forms

我项目中的PushRow已禁用取消选择选项。目前,我正在尝试提供诸如向显示的视图添加额外的“无”行之类的选项。怎么可能?

private func createCustomPushRow(for field: JSON) {

    let typeId = field["field_type_id"].intValue
    let type = field["field_type"].stringValue
    var label = field["field_label"].stringValue
    let required = field["field_required"].boolValue

    var optionList: [String] = [String]()
    for customField in field["field_options"].arrayValue {
        optionList.append(customField["option_title"].stringValue)
    }

    label = required ? label + " *" : label
    form +++ Section(label)
        <<< PushRow<String>(String(typeId)) {
        $0.title = label.lowercased()
        $0.selectorTitle = "Pick " + label.lowercased()
        $0.options = optionList
        if required {
            $0.add(rule: RuleRequired())
            $0.validationOptions = .validatesOnChange
        }
        }.onPresent({ (_, to) in
            to.enableDeselection = false
        })
}

Expected output

0 个答案:

没有答案