In a UITableView
that needs to display a long list of chatlike conversations, often containing emojis, a size calculation error occurs.
My problem is, that
I am use UILabel
sizeThatFits(_ size: CGSize) -> CGSize
It work for me.
my code
let tempLabel = UILabel()
tempLabel.font = font
tempLabel.attributedText = attText
tempLabel.numberOfLines = 0
let size = tempLabel.sizeThatFits(CGSize(width: 200, height:CGFloat.greatestFiniteMagnitude))
as the code, you need to assign three property.