如果我使用DateInlineRow或任何其他内联行,则无法清除该值。怎么办呢?
答案 0 :(得分:1)
我一直在处理您的问题,我将使用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()
}
}