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

How to clear a value from an inline row, such as DateInlineRow?

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

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

如果要清除值

   <<< DateInlineRow(){
        [=10=].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()
                        }
                    }