我有两个UILabel
在厦门国际银行文件,我使用的plist文件来编辑它的文本。如何传递两个字符串中NSMutableAttributedString
我想增加两个UILabels
“标题”和“细节”行间距。
为了增加行距,我实施了NSMutableAttributedString
。但我不知道如何在一个类中传递两个字符串。
该问题的任何解决方案?
class PlaySheetCellLeft: UITableViewCell {
@IBOutlet var LBLTitle:UILabel!
@IBOutlet var LBLDetail:UILabel!
var message:[String:Any]? {
didSet{
guard let msg = self.message else { return }
let title = msg["title"] as! String
self.LBLTitle.text = title
let details = msg["detail"] as! String
self.LBLDetail.text = details
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 10
//error code
let attrString = NSMutableAttributedString(string: title, string: details)
attrString.addAttribute(NSParagraphStyleAttributeName, value:paragraphStyle, range:NSMakeRange(0, attrString.length))
LBLTitle.attributedText = attrString
}
}
难道你不希望显示标题和细节在它的简单和容易
两个不同的标签? –
是的,这就是我想要的! – risa8