BonMot icon indicating copy to clipboard operation
BonMot copied to clipboard

Bug with .lineSpacing attribute

Open baevra opened this issue 5 years ago • 3 comments

.lineSpacing + .tracking or .adapt Screen Shot 2019-07-17 at 16 53 18 .lineSpacing only Screen Shot 2019-07-17 at 16 54 27 .lineSpacing + .tracking or .adapt Screen Shot 2019-07-17 at 16 55 16


This bug appears only with single line strings, this is not a BonMot bug, its probably NSAttributedString bug @ZevEisenberg Any ideas?

baevra avatar Jul 17 '19 10:07 baevra

@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 avatar Jul 18 '19 17:07 ZevEisenberg

@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

baevra avatar Jul 20 '19 04:07 baevra

In iOS 13 its works as expected

baevra avatar Sep 25 '19 14:09 baevra