swift - Swift Eureka 中的子表单

标签 swift swift3 eureka-forms

我在 Swift 3 项目中使用 Eureka Form-Framework。

我需要使用 MultivaluedSection,但不是从字符串选项数组中获取字符串(如下面的代码),我想在呈现的 Controller 中打开一个子表单(例如,使用 TextRow、NumberRow 等)。

我知道,我可以实现自定义演示者行,但我找不到为自定义演示者行显示“子表单”的解决方案。

Eureka 框架甚至可以做到这一点吗?

let multivaluedSection = MultivaluedSection(multivaluedOptions: [.Insert, .Delete],
                                                    header: rawField["name"].stringValue,
                                                    footer: "")
multivaluedSection.multivaluedRowToInsertAt = { index in
            return PushRow<String>{
                $0.title = "Tap to select ;)..at \(index)"
                $0.options = ["Option 1", "Option 2", "Option 3"]
            } }
self.form.append(multivaluedSection)

最佳答案

这可以使用自定义选择器行来完成。

您只需要按照说明进行操作here , 制作自定义推行,

public final class CustomPushRow: SelectorRow<PushSelectorCell<SomeType>, YourSubFormVC>, RowType {

    public required init(tag: String?) {
        super.init(tag: tag)
        presentationMode = .show(controllerProvider: ControllerProvider.callback {
            return YourSubFormVC(){ _ in }
            }, onDismiss: { vc in
                _ = vc.navigationController?.popViewController(animated: true)
        })
    }
}

YourSubFormVC 是用户点击该行时将显示的 VC。它应该符合 TypedRowControllerType。因为你希望这个 VC 也是一个表单,所以让它继承 FormViewController 并开始在 viewDidLoad 中构建表单!

关于swift - Swift Eureka 中的子表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47269180/

相关文章:

ios - Swift JSON 解析并打印数组中的指定值

ios - 在 swift 3 中执行带有对象的选择器

iOS Eureka 创建后更改节标题

ios - Cocoapods/Eureka 编译错误 : linker command failed with exit 1

swift - 完成从服务器 Swift 获取数据后调用函数

ios - 根据行数更改 UITableView 的大小

swift - "ambiguous reference to member '下标错误如何解决'”

ios - Xcode 8.3 中的构建时间太长,特别是文件中的 swift 3

ios - swift 3 : Use NSPredicate(format:) to filter objects by type/class

swift4 - Eureka 内联选择器行选择第一行