如果日期(小标题)比今天早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天?
当问题 陈述简单地“它不起作用”时,很难提供解决方案。请编辑您的 问题,以更全面地描述您的 预期会发生什么,以及与实际的 结果有何不同。请参阅[问]提示什么使得一个好的 解释。 –