我有以下代码:
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并显示一些选项。一旦点击至少一个选项,它应显示“完成”按钮并能够返回。即使我从官方示例中获取代码,该按钮也不会出现。
我在这里想念的是什么,或者我需要做什么才能解雇弹出的Field?
谢谢 :)
multipleSelectorDone函数如下:
func multipleSelectorDone(_ item: UIBarButtonItem) {
_ = navigationController?.popViewController(animated: true)
}
有一个项目的相同功能,并发现了这个问题。如果有人需要这里是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)
}