使 Eureka DateTimeInlineRow 值显示在 textLabel 而不是 detailTextLabel 中
Make Eureka DateTimeInlineRow value show in textLabel rather than detailTextLabel
所以我正在尝试自定义 Eureka 库中的 DateTimeInlineRow
以在标题位置而不是详细位置显示所选日期。替换下图所示的'placeholder' "Date":
我尝试了很多方法都没有成功,这是我最后一次尝试:
<<< DateTimeInlineRow() { row in
row.tag = "date"
}.cellSetup { cell, row in
row.title = "Date"
}.cellUpdate { cell , row in
if let date = row.value {
row.title = DateFormatter().string(from: date)
}
cell.textLabel?.textColor = row.title == "Date" ? .gray : .black
}
您需要设置 cell.textLabel?.text
以使您的日期字符串成为标题
<<< DateTimeInlineRow() { row in
row.tag = "date"
}.cellSetup { cell, row in
row.title = "Date"
cell.detailTextLabel?.text = ""
}.cellUpdate { cell , row in
if let date = row.value {
cell.textLabel?.text = row.dateFormatter?.string(from: date)
}
cell.textLabel?.textColor = row.title == "Date" ? .gray : .black
cell.detailTextLabel?.text = ""
}
截图
所以我正在尝试自定义 Eureka 库中的 DateTimeInlineRow
以在标题位置而不是详细位置显示所选日期。替换下图所示的'placeholder' "Date":
我尝试了很多方法都没有成功,这是我最后一次尝试:
<<< DateTimeInlineRow() { row in
row.tag = "date"
}.cellSetup { cell, row in
row.title = "Date"
}.cellUpdate { cell , row in
if let date = row.value {
row.title = DateFormatter().string(from: date)
}
cell.textLabel?.textColor = row.title == "Date" ? .gray : .black
}
您需要设置 cell.textLabel?.text
以使您的日期字符串成为标题
<<< DateTimeInlineRow() { row in
row.tag = "date"
}.cellSetup { cell, row in
row.title = "Date"
cell.detailTextLabel?.text = ""
}.cellUpdate { cell , row in
if let date = row.value {
cell.textLabel?.text = row.dateFormatter?.string(from: date)
}
cell.textLabel?.textColor = row.title == "Date" ? .gray : .black
cell.detailTextLabel?.text = ""
}
截图