YYText icon indicating copy to clipboard operation
YYText copied to clipboard

ios11上有特殊符号字符的话会出现计算高度问题

Open YanPengImp opened this issue 8 years ago • 7 comments

text:# 我的星宿物语 准的爆棚,哈哈哈哈୧(๑·̀⌄·́๑)૭ 在iOS11会YYLabel导致这段文字下面出现很多空白区域,计算出来高度太大。

YanPengImp avatar Nov 06 '17 03:11 YanPengImp

ios11 debug 发现 _lineWidth = CTLineGetTypographicBounds(_CTLine, &_ascent, &_descent, &_leading); _descent 特别大

daviad avatar Feb 12 '18 09:02 daviad

if (@available(iOS 11.0, *)) { CGRect tempRect = CTLineGetBoundsWithOptions(_CTLine, 0); _descent = tempRect.size.height - _ascent; } 先这样把bug 解决吧。 哎!

daviad avatar Feb 12 '18 10:02 daviad

Mark

Zorodon avatar Feb 22 '18 02:02 Zorodon

@daviad 感謝大大提供解法 我用swizzle方式直接放入專案中,等大大更新了再拿掉即可 https://gist.github.com/g761007/9f12c5de4d77de8cff74ea9456a055ff

g761007 avatar Aug 02 '18 01:08 g761007

@g761007 谢谢你,使用了你的代码,解决了我的问题。

TimorYang avatar Oct 22 '18 03:10 TimorYang

@daviad 感謝大大提供解法 我用swizzle方式直接放入專案中,等大大更新了再拿掉即可 https://gist.github.com/g761007/9f12c5de4d77de8cff74ea9456a055ff

网址打不开,能贴下代码吗

jkwf avatar Jan 20 '19 10:01 jkwf

@g761007 swizzle方式 YYTextVerticalAlignmentCenter 上下还是没有居中

BeingCode avatar Nov 27 '21 06:11 BeingCode