BonMot
BonMot copied to clipboard
Bug with .lineSpacing attribute
.lineSpacing + .tracking or .adapt
.lineSpacing only
.lineSpacing + .tracking or .adapt
This bug appears only with single line strings, this is not a BonMot bug, its probably NSAttributedString bug @ZevEisenberg Any ideas?
@baevra would you mind posting a sample project, preferably without BonMot so that we can confirm that it’s an NSAttributedString
bug? Then, I or someone else might be able to think of a workaround. But also, it will give you a good sample project to send to Apple as a bug report.
@ZevEisenberg https://github.com/baevra/NSAttributedStringBug
I found that .writeDirection
+ .lineSpacing
also creates empty space
To fix this issue I created a wrapper (UIView) around UILabel that is calculates size in sizeThatFits
and forces height to be equal to font.lineHeight
if labels sizeThatFits
returns height < font.lineHeight * 1.5 + .lineSpacing
its weird but it works :D
In iOS 13 its works as expected