【Swift】首行缩进两个字符
作者:
MMD_ | 来源:发表于
2018-09-04 10:48 被阅读55次 let paraStyle01 = NSMutableParagraphStyle()
paraStyle01.alignment = .left
//对齐
paraStyle01.headIndent = 0.0
//行首缩进
//参数:(字体大小17号字乘以2,34f即首行空出两个字符)
let emptylen: CGFloat = contentLabel.font.pointSize * 2
paraStyle01.firstLineHeadIndent = emptylen
//首行缩进
paraStyle01.tailIndent = 0.0
//行尾缩进
paraStyle01.lineSpacing = 2.0
//行间距
let attrText = NSAttributedString(string: model.msgContent ?? "", attributes: [.paragraphStyle: paraStyle01])
contentLabel.attributedText = attrText
本文标题:【Swift】首行缩进两个字符
本文链接:https://www.haomeiwen.com/subject/fdcgwftx.html
网友评论