Swift SelectorRow的变换选项
是否可以转换多个选择器箭头的选项?我想将每个选项转换为Swift SelectorRow的变换选项,swift,eureka-forms,Swift,Eureka Forms,是否可以转换多个选择器箭头的选项?我想将每个选项转换为$0。大写。我第一次尝试了$0.displayValueFor,但看起来这是表单中显示的值?通过阅读这些问题,我能够做到: .onPresent { _, to in to.sectionKeyForValue = { $0.capitalized } } 这将添加节。是否有任何属性允许我映射选项以显示值?请尝试使用此代码 <<< MultipleSelectorRow<String>() {
$0。大写。我第一次尝试了$0.displayValueFor
,但看起来这是表单中显示的值?通过阅读这些问题,我能够做到:
.onPresent { _, to in
to.sectionKeyForValue = { $0.capitalized }
}
这将添加节。是否有任何属性允许我映射选项以显示值?请尝试使用此代码
<<< MultipleSelectorRow<String>() {
$0.options = ["prueba","prueba","prueba3"]
$0.tag = "gradeType"
$0.title = "Grade Types"
$0.selectorTitle = "Pick the posted grade types"
//$0.value = prevGradeTypeList
//$0.options = gradeTypePicker
}.cellSetup({ (pushSelectorCell, row) in
row.options = row.options.map({$0.capitalized})
})
这也可能有效:
.onPresent { _, to in
to.selectableRowCellUpdate = { cell, row in
if let title = row.selectableValue?.capitalized {
cell.textLabel?.text = title
}
}
当我调用form.values()
时,这仍然提供了大写版本。这与在设置中将选项设置为大写没有什么不同。我需要一个函数,它只将选项映射到显示的值,而不是实际值。