gpt4 book ai didi

ios - 如何清除内联行中的值,例如 DateInlineRow?

转载 作者:行者123 更新时间:2023-11-28 06:13:40 24 4
gpt4 key购买 nike

如果我使用 DateInlineRow 或任何其他内联行,则无法清除该值。如何做到这一点?

最佳答案

我一直在研究你的问题,我将以 DateInlineRow 为例

如果要清除值

   <<< DateInlineRow(){
$0.tag = "inlineDateTime"
}.cellSetup({ (dateCell, dateTimeRow) in
// Setup the start date
let currentDate = NSDate() as Date
dateTimeRow.dateFormatter?.dateStyle = .short
dateTimeRow.dateFormatter?.timeStyle = .short
dateTimeRow.value = currentDate
dateCell.textLabel?.text = "" //if you want clear the value in creation
}).onCellSelection({ (cell, row) in
row.cell.textLabel?.text = "" //if you want clear the value in cell selection
}).onChange({ (row) in
row.cell.textLabel?.text = "" //if you want clear the value on value change
})

如果您想清除其他按钮中的值

按标签搜索并将行的值设置为nil

if let dateTimeInlineRow = self.form.rowBy(tag: "inlineDateTime") as? DateInlineRow
{
if let baseCellText = dateTimeInlineRow.baseCell as? Cell<Date>
{
baseCellText.row.value = nil
baseCellText.update()
}
}

关于ios - 如何清除内联行中的值,例如 DateInlineRow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45744043/

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