NSMutableAttributedString上的iOS行间距属性

时间:2023-02-01 08:01:02

How can we set line spacing or line height on NSMutableAttributedString. I have tried with

我们如何在NSMutableAttributedString上设置行间距或行高。我试过了

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraphStyle setLineSpacing:150] ;
paragraphStyle.minimumLineHeight = 150;
[self addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, self.length)];

with No luck.

没有运气。

any suggestion would be much appreciated.

任何建议将不胜感激。

Thanks

谢谢

1 个解决方案

#1


5  

You need to set paragraphStyle.maximumLineHeight.

您需要设置paragraphStyle.maximumLineHeight。

I hope it will help!

我希望它会有所帮助!

#1


5  

You need to set paragraphStyle.maximumLineHeight.

您需要设置paragraphStyle.maximumLineHeight。

I hope it will help!

我希望它会有所帮助!