On iOS 14 when attaching an image to a NSAttributedString the resulting height of the label is correct, however on iOS 15 it is too tall.
iOS 14:
iOS 15:
Code:
view.backgroundColor = .black
label.layer.borderColor = UIColor.red.cgColor
label.layer.borderWidth = 1
let font = UIFont.systemFont(ofSize: 11, weight: .bold)
let text = NSMutableAttributedString(string: "LIVE", attributes: [.foregroundColor: UIColor.systemGreen, .font: font])
let attach = NSTextAttachment()
attach.image = UIImage(named: "live_indicator_image")!
let imageString = NSMutableAttributedString(attachment: attach)
text.append(imageString)
label.attributedText = text
Image:
Xcode version: 13.1
Simulator: iPhone 13 (15.0), iPhone 12 (14.4)