如何UILabel在Swift中强调一下?我搜索了Objective-C但却无法让它们在Swift中工作.
我有一个 UILabel 我想将它的某些部分作为下划线。我正在使用下面的代码。但它强调整个标签而不是标签的某些部分。请告诉我如何使标签的某些部分成为下划线。
let attributedString = NSMutableAttributedString(string: "UserAgreement".localized)
attributedString.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.styleSingle.rawValue, range: NSRange(location: 0, length: 10))
labelTc.attributedText = attributedString
Run Code Online (Sandbox Code Playgroud)
我不想处理故事板