ara*_*ker 1 swift eureka-forms swift4
我正在使用Eureka表单,用户可以在其中选择日期。当用户选择第一个日期时,我想更新第二行中的第二个日期(在第一天中增加30天)。
<<< DateRow(){
$0.value = Date()
$0.title = "First Date"
$0.tag = "firstDate"
.onChange({ (row) in
<< update secondDate = firstDate + 30 days >>
} )
<<< DateRow(){
$0.value = Date()
$0.title = "Second Date"
$0.tag = "secondDate"
Run Code Online (Sandbox Code Playgroud)
我该如何实现?
请找到以下解决方案。
func createSection() {
let section = Section("Section2") { section in
section.header?.height = { 40 }
}
<<< DateRow() {
$0.value = Date()
$0.title = "First Date"
$0.tag = "First"
}.onChange({ (row) in
let secondRow = self.form.rowBy(tag: "Second") as! DateRow
let date = row.value!
let newDate = date.addingTimeInterval(30*24*60*60)
secondRow.value = newDate
secondRow.reload()
})
<<< DateRow() {
$0.value = Date()
$0.title = "Second Date"
$0.tag = "Second"
}.onChange({ (row) in
})
form +++ section
}
Run Code Online (Sandbox Code Playgroud)
如有任何疑问,请通知我。
| 归档时间: |
|
| 查看次数: |
442 次 |
| 最近记录: |