Swift编程

swift设置行高,字间距

2020-05-06  本文已影响0人  何以消摇

设置行高,关键词NSAttributedString.Key.paragraphStyle
attribute 属性
paragraph 段落

// 设置行间距
let style = NSMutableParagraphStyle()
// 间隙
style.lineSpacing = 5
label.attributedText = NSAttributedString(string: text,
                            attributes: [NSAttributedString.Key.paragraphStyle: style])

设置字间距,关键词NSAttributedString.Key.kern
kern 紧排

// 字间距
label.attributedText = NSAttributedString(string: "累计鉴别已超过", 
                            attributes: [NSAttributedString.Key.kern : 5])
上一篇 下一篇

猜你喜欢

热点阅读