ok so I have a label called eventStatus
var eventStatus: UILabel!
eventStatus = UILabel()
eventStatus.frame = CGRect(x: 0, y: frame.height-60, width: frame.width, height: 30)
eventStatus.textColor = UIColor(r: 255, g: 255, b: 255)
eventStatus.backgroundColor = UIColor.red.withAlphaComponent(0.3)
eventStatus.textAlignment = .center
eventStatus.font = eventStatus.font.withSize(14)
contentView.addSubview(eventStatus)great this all works fine and my label shows different status in my collectionViewController
However, I would like to style my cells depending on what the status text reads but when I do the following statement, nothing happens
if(eventStatus.text == "Found"){
tabCat.image = UIImage(named: "found-tab")
eventTitle.backgroundColor = UIColor.green.withAlphaComponent(0.3)
eventDate.backgroundColor = UIColor.green.withAlphaComponent(0.3)
} else if(eventStatus.text == "Lost"){
tabCat.image = UIImage(named: "lost-tab")
eventTitle.backgroundColor = UIColor.red.withAlphaComponent(0.3)
eventDate.backgroundColor = UIColor.red.withAlphaComponent(0.3)
} else if(eventStatus.text == "brokenglass"){
tabCat.image = UIImage(named: "hazard-tab")
eventTitle.backgroundColor = UIColor.orange.withAlphaComponent(0.3)
eventDate.backgroundColor = UIColor.orange.withAlphaComponent(0.3)
} else if(eventStatus.text == "flooding"){
tabCat.image = UIImage(named: "hazard-tab")
eventTitle.backgroundColor = UIColor.orange.withAlphaComponent(0.3)
eventDate.backgroundColor = UIColor.orange.withAlphaComponent(0.3)
} else if(eventStatus.text == "graffiti"){
tabCat.image = UIImage(named: "hazard-tab")
eventTitle.backgroundColor = UIColor.orange.withAlphaComponent(0.3)
eventDate.backgroundColor = UIColor.orange.withAlphaComponent(0.3)
}eventStatus.text is showing as nil when I debug
Please, any help here is much appreciated
Thanks