This issue occurs only in iOS 13. First time UITableViewCell
is showed font and color will be from storyboard while the text is from attributed string. When the cell is reused, it will take font and color from atributed string.
This is my code in
func tableView(_ tableView: UITableView, cellForRowAt indexPath:IndexPath) -> UITableViewCell {
let message = NSMutableAttributedString(string: "\(name): \(messageBody))", attributes: lastMessageAttributes)
message.addAttributes(senderLastMessageAttributes, range: NSRange(location: 0, length: name.count + 1))
}
I have tried also
let message = NSMutableAttributedString(string: "\(name):)", attributes: lastMessageAttributes)
message.append(NSAttributedString(string: messageBody, attributes: senderLastMessageAttributes))
also this
let message = NSMutableAttributedString(string: "\(name):)", attributes: lastMessageAttributes)
message.append(NSAttributedString(string: messageBody, attributes: senderLastMessageAttributes))
let newMessage = NSMutableAttributedString(attributedString: message)
If I do not add any attributed it is working, like this:
let message = NSMutableAttributedString(string: "\(name): \(messageBody))", attributes: lastMessageAttributes)