我用尤里卡格式创建了一个推行,在选择最后一个选项时我需要添加一个新行。我在选择最后一个选项时展示了一个UIAlertViewController,并将输入的文本附加到选项数组中,但是无法重新加载新选项。有什么办法可以重新加载选项?
我尝试重新加载该行,并为此检查了所有堆栈溢出后的内容。但无法解决。
.onPresent { from, to in
to.selectableRowCellUpdate = { cell, row in
if row.selectableValue == "Add New"{
to.dismissOnSelection = false
to.dismissOnChange = false
row.cellUpdate({ (cellCheck, rowCheck) in
if self.disclaimerHasBeenDisplayed == false {
self.disclaimerHasBeenDisplayed = true
let alert = UIAlertController(title: "Add new LSD value", message: "", preferredStyle: UIAlertControllerStyle.alert)
alert.addTextField {
$0.placeholder = "Enter value"
$0.addTarget(alert, action: #selector(alert.textDidChangeInLoginAlert), for: .editingChanged)
}
alert.addAction(UIAlertAction(title: "Add", style: UIAlertActionStyle.default, handler: { (action) -> Void in
if alert.textFields?[0].text != ""{
self.createNewLSD((alert.textFields?[0].text)!, completionHandler: { (result) in
//self.disclaimerHasBeenDisplayed = false
self.lsdArray.append((alert.textFields?[0].text)!)
})
}else{
print("no text")
}
}));
self.present(alert, animated: true, completion: nil)
}
})
}
for item in self.LSDs{
if row.selectableValue! == (item.text ?? ""){
self.selectedLSD = Int(item.value)
}
}
}
to.dismissOnSelection = true
to.dismissOnChange = true
}
添加alert.textField数据后需要重新加载选项。