美文网首页
iOS swift 行间距

iOS swift 行间距

作者: L千载难逢 | 来源:发表于2020-04-29 11:42 被阅读0次

    //行间距

    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

    }

    相关文章

      网友评论

          本文标题:iOS swift 行间距

          本文链接:https://www.haomeiwen.com/subject/xfjgwhtx.html