iOS swift 行间距

2020-04-29  本文已影响0人  L千载难逢

//行间距

func ParagraphStyle(string:String,lineSpacing:CGFloat) -> NSMutableAttributedString {

     let paragraphStye =NSMutableParagraphStyle()

     //调整行间距

     paragraphStye.lineSpacing= lineSpacing

     paragraphStye.lineBreakMode = NSLineBreakMode.byWordWrapping

    let attributedString =NSMutableAttributedString.init(string: string, attributes: [NSAttributedString.Key.paragraphStyle:paragraphStye])

    return attributedString

}

上一篇下一篇

猜你喜欢

热点阅读