Eureka Swift:解散MultipleSelectorRow的控制器

时间:2016-11-09 00:39:03

标签: swift eureka-forms

我有以下代码:

form.last! <<< MultipleSelectorRow<String>() {
                $0.title = field.question
                $0.options = []
                for option in field.answers {
                    $0.options.append(option.answer)
                }
            }.onPresent {
                    from, to in
                // TODO FIX
                to.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: from, action: #selector(InputVC.multipleSelectorDone(_:)))
            }

哪个应该添加一个MultipleSelectorRow - 如果点击 - 弹出另一个VC并显示一些选项。一旦点击至少一个选项,它应该显示&#34;完成&#34;按钮,能够回去。即使我从官方示例中获取代码,该按钮也不会出现。

我在这里想念的是什么,或者我需要做什么才能解雇弹出的Field?

谢谢:)

multipleSelectorDone函数如下:

func multipleSelectorDone(_ item: UIBarButtonItem) {
        _ = navigationController?.popViewController(animated: true)
    }

1 个答案:

答案 0 :(得分:0)

对项目具有相同的功能并发现了这个问题。如果有人需要,这是Swift 4.2的解决方案

<<< MultipleSelectorRow<String>() {
    $0.title = "Subjects"
    $0.selectorTitle = "Choose"
    $0.options = ["Option 1", "Option 2", "Option 3", "Option 4"]
    $0.tag = "subjectTypes"
}.onPresent { from, to in
    to.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: from, action: #selector(self.multipleSelectorDone(_:)))
}

multipleSelectorDone方法是:

@objc func multipleSelectorDone(_ sender:Any?) {
    _ = navigationController?.popViewController(animated: true)
}