如何在为UILabel设置行间距后添加省略号?

时间:2016-01-29 03:36:26

标签: ios swift uilabel nsmutableattributedstring

我发现UILabel使用设置行间距,他不再显示省略号的大小即使他不够,我想知道如何添加省略号

    let message:NSString = "Perhaps you are an average student with average intelligence." 

    let attributedString = NSMutableAttributedString(string: str as String)
    let paragraphStyle = NSMutableParagraphStyle();
    paragraphStyle.lineSpacing = 5
    attributedString.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSMakeRange(0, message.length))
    detailLabel.attributedText = attributedString

1 个答案:

答案 0 :(得分:0)

你的意思是圆角?如果你想要完美的圆角添加

detailLabel.layer.cornerRadius = detailLabel.frame.height / 2