gpt4 book ai didi

swift - 如何根据另一个 row.value 更新 row.value

转载 作者:搜寻专家 更新时间:2023-11-01 06:01:27 26 4
gpt4 key购买 nike

我正在使用 Eureka form ,其中用户选择日期。当用户选择第一个日期时,我想更新第二行中的第二个日期(第一天增加 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"

我怎样才能做到这一点?

最佳答案

请找到以下解决方案。

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
}

如有任何疑问,请告诉我。

关于swift - 如何根据另一个 row.value 更新 row.value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49017868/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com