Skip to content

Instantly share code, notes, and snippets.

@dolphinSuPixnet
Created September 16, 2015 01:52
Show Gist options
  • Save dolphinSuPixnet/7cc7c8b8985529d0cba3 to your computer and use it in GitHub Desktop.
Save dolphinSuPixnet/7cc7c8b8985529d0cba3 to your computer and use it in GitHub Desktop.
We can use this create HTML based attributed string. 我們可以這樣建立一個 HTML 樣式的 attributed string
var attrStr = NSAttributedString(
data: "<b><i>text</i></b>".dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true),
options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],
documentAttributes: nil,
error: nil)
label.attributedText = attrStr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment