UILabel に太字、斜体、リンクを含む HTML テキストを配置する必要があります。リンクを使用するNSAttributedString
と、クリックできなくなります。リンクを使用するTTTAttributedLabel
とクリック可能になりますが、書式設定 (太字と斜体) が表示されません。
この問題は私を夢中にさせます!アイデア?
UILabel に太字、斜体、リンクを含む HTML テキストを配置する必要があります。リンクを使用するNSAttributedString
と、クリックできなくなります。リンクを使用するTTTAttributedLabel
とクリック可能になりますが、書式設定 (太字と斜体) が表示されません。
この問題は私を夢中にさせます!アイデア?
TTTAttributedLabel を使用して、リンクの書式設定を機能させることができます。たとえば、これはリンクを青く色付けし、下線を付けます (Swift の場合):
let bodyLabel: TTTAttributedLabel
let content = "TTTAttributedLabel will detect http://example.com"
let attributedContent = NSMutableAttributedString(string: content)
// add some attributes as you need to the attributed string, then...
let blueLinks = [NSForegroundColorAttributeName: UIColor.blueColor()]
bodyLabel.enabledTextCheckingTypes = NSTextCheckingType.Link.rawValue
bodyLabel.linkAttributes = blueLinks
bodyLabel.setText(attributedContent)