如果日期(小標題)比今天早5天,我想將tableview中的行顏色更改爲紅色。我想是這樣的:(例如與文本框顏色)Swift tableview row color based on subtitle
// Configure the cell...
cell.textLabel?.textColor = UIColor.blueColor()
cell.detailTextLabel?.textColor = UIColor.darkGrayColor()
let item = frc.objectAtIndexPath(indexPath) as! Item
cell.textLabel?.text = item.name! + "-" + item.etage! + "-" + item.raum!
let note = item.date
cell.detailTextLabel!.text = "\(note!)"
if note == "04.04.2016 20:31:55" {
cell.detailTextLabel?.textColor = UIColor.redColor()
} else {
}
return cell
}
和它的作品..但只有在準確的時間(分,秒)。 我如何才能做到這一點,比較只有一天減去5天?
當問題 陳述簡單地「它不起作用」時,很難提供解決方案。請編輯您的 問題,以更全面地描述您的 預期會發生什麼,以及與實際的 結果有何不同。請參閱[問]提示什麼使得一個好的 解釋。 –