I\'m using a UITableView
to show the list of transactions of a credit card. If the transaction is a chargeback, I\'m adding a strikethroug
Alex answer did fix my problem, but I've also found out why the reset of the labels didn't work. I'll leave it here in case it's useful for someone.
For some reason, if I reset only the attributedText
, it works:
transactionDescriptionLabel.attributedText = nil
transactionValueLabel.attributedText = nil
Or, if I reset the attributedText
first, and then reset the text
, it also works:
transactionDescriptionLabel.attributedText = nil
transactionValueLabel.attributedText = nil
transactionDescriptionLabel.text = nil
transactionValueLabel.text = nil
According to the UILabel
documentation, assigning a new value to either property replaces the value of the other, so the order should not matter. But it does, apparently.
https://developer.apple.com/documentation/uikit/uilabel/1620538-text
https://developer.apple.com/documentation/uikit/uilabel/1620542-attributedtext